## gluProject help

Moderator
Posts: 608
Joined: 2002.04
Post: #1
How do I get the model, view and projection matrix for calling gluProject?
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
Code:
GLdouble modelviewMatrix[16];
GLdouble projectionMatrix[16];
GLint viewport[4];

glGetDoublev(GL_MODELVIEW_MATRIX, modelviewMatrix);
glGetDoublev(GL_PROJECTION_MATRIX, projectionMatrix);
glGetIntegerv(GL_VIEWPORT, viewport);
Member
Posts: 196
Joined: 2002.04
Post: #3
Hmm I don't know, but I looked in the command line (typed in "man gluProject"). Try glGet maybe?? I'm not sure so type in "man glGet" in the command line to get the details. I've been looking for something to output the current verticies like something below. If any one can help me out too that would be nice.

glTranslatef(x,y,z);
glRotate(angle, 0.0, 0.0, 1.0);
// print out what x and y equal after they're rotated by "angle".

Iceman

Update: Dang OSC got his post out before I was done typing!
Moderator
Posts: 608
Joined: 2002.04
Post: #4
Is this a record? OSC answered a question in 12 minutes.

Thanks!
Luminary
Posts: 5,143
Joined: 2002.04
Post: #5
Nah I'm usually much faster.

Iceman, you can multiply by the modelview matrix to figure out where your vertices are getting transformed to, not sure if that's really what you want to do, though.
Member
Posts: 196
Joined: 2002.04
Post: #6
Faster?!! I guess that's what I feared about using OpenGL to get the transformation; it would be way over my head with matrices and such. I'm using another method for now anyway; I just use radians, cosine, and sine to calculate it.

Thanks,
Iceman