Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Apple's iTunes Artwork screensaver



The "nearly" OpenGL coordinate system is quite tricky when it comes to absolute positionning.
The attached compo will do the job you're looking for
It looks a bit heavy for such a common task, but to that's the best way i've found.


Attachment: RenderAtTopLeft.qtz
Description: application/quartzcomposer




Some explanations now:

First, we try to 'attach' our image image to the left edge.
in the QC coordinates system, the width of the view is always 2. The origin is at the center of the screen
we always have the left edge of the view at X = -1, and the right edge of the view at X=1.
If you set the X position of your billboard to -1, you have the center of the image aligned on the left edge,
because X define the position of the center of your billboard. To correct this, you just have to add the (width of the image) / 2. You achieve this using an "image dimensions" and "Math" patch.


OK, we're done for the X coord, now Y:

unlike the width, the height of the viewport depends on the aspect ratio of your viewport. If you're viewport is twice as high as it is wide, the height of the patch is 4 (2x width). The "height" output of the "Rendering Destination Dimensions" patch give what you're looking for. Using that, you know that the y coordinate of the bottom and top edges are respectively is -height / 2 and height / 2
As before, you need to compensate the fact that image are postioned by their center, you need to substract one half of the image height. You're done.
Note this works only if you render your billboard at scale 1 (i.e. by biding the image "width" output to your Billboard's "width" input


--
Xavier Michelon


On May 18, 2005, at 18:45, patrick wrote:

That's excellent news!

Perhaps I could do it all in a single composition file; but one of my
major challenges is using the co-ordinate system that Quartz Composer
(OpenGL?) uses. I so far haven't really found any good way of
positioning something exactly in the upper-left corner of the screen.
I have a square sprite whose X and Y co-ordinates are set to (-0.84,
-0.6) which seems pretty close to the upper left, but not exactly.
Plus, these co-ordinates are not very intuitive to me. Is there any
way I can do a weird-coordinate-to-pixel conversion?

Thanks,

Patrick

On 5/16/05, Pierre-Olivier Latour <email@hidden> wrote:



Provided that I'm not worried about supporting lower-end systems and
anything before Tiger, would it be a bad approach to load a Quartz
composition multiple times on the screen and getting each instance to
do all of the transition work, or would it be considerably better
(from a memory and processor usage point of view) to do everything
programmatically using OpenGL calls to load the images onto planes on
which the transitions will occur?
Assuming you cannot or do not want to put everything into a single
composition file, you can definitely create multiple QCRenderers from the
same composition and mix their drawing with your custom OpenGL code. The
overhead of a QCRenderer is very low.





________________________________________________________

Pierre-Olivier Latour                            email@hidden

Quartz Composer Architect                Graphic & Imaging Team


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list (Quartzcomposer- email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/xmi% 40hispeed.ch


This email sent to email@hidden


Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/email@hidden

This email sent to email@hidden

References: 
 >Apple's iTunes Artwork screensaver (From: patrick <email@hidden>)
 >Re: Apple's iTunes Artwork screensaver (From: Pierre-Olivier Latour <email@hidden>)
 >Re: Apple's iTunes Artwork screensaver (From: patrick <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.