Subject: Re: using glVertex*() in a second coordinate frame
Jim Bancroft wrote:
> I want to draw some surrounding geometry around this particle, using the
> particle's axes and origin as the reference for the commands. So in other
> words, when I say glVertex3f(1.0f,0.0f,0.0f) I want to place a vertex one
> unit in the x-direction along the particle's x axis....not along the world
> space x-axis.
> I've tried everything I can think of, which admittedly isn't much. Among
> other things I've used gluLookAt() with the particle's origin values as the
> first three parameters, an appropriate look at point for the second three
> parameters, and the particle's y axis as the final three params. Nothing
> I'm certainly not wedded to using gluLookAt(). Any method which would let
> me draw my geometry around the particle's coordinate system is fine with me.
> I'm open to any and all suggestions on what I can/should be doing and if you
> have any code snippets, all the better. Thanks very much.
Push the current coordinate system on the stack (glPushMatrix) then
transform the coordinate system to the particle frame (either
glMultMatrix or glLoadMatrix depending whether the particle coordinates
are resp. to current coordinates or not). The matrix you need to pass
consist of three vectors beeing the local axes and the last column
being the particle position (but be aware that OpenGL uses column-major
Now you can define the coordinates with respect to the particle frame.
And don't forget to get back to the previous frame (glPopMatrix) at the
"Beauty is the first test: there is no permanent place
in the world for ugly mathematics." G.H. Hardy
View All Messages in comp.graphics.algorithms
using glVertex*() in a second coordinate frame =>
Re: using glVertex*() in a second coordinate frame
Copyright © 2006 WatermarkFactory.com. All Rights Reserved.