Skip to main content
gamedev.net
🔒 Locked

matrix question

Started by dario_s May 14, 2003 at 6:30 PM 3 replies 2k views
Original Post
dario_s
dario_s
Hi, I have a little wierd problem. You see, I want to be able to determine a vertex-point inside a glPushMatrix() thing... My code looks something like this:
glPushMatrix();
  //load and render a model
glPopMatrix();
  
Inside that matrix, I want to determine a vertex which is valid outside that matrix... Do I make any sense?? Well, lets put it this way. In that matrix I get a point which is x = 1.5 y = 0 z = 2.0 But in the "world" matrix it's rendered at x = 10.5 y = 2.0 z = 4.0 I want to somehow transform the vertex from its local coordinate system to the world coordinate system. Is that possible? [edited by - dario_s on May 14, 2003 7:30:53 PM]
benjamin bunny
benjamin bunny
Your post is a bit unclear, but I'll take a wild guess anyway:

To get the translated vertex (eye) coordinates, multiply the untransformed vertex coordinates by the modelview matrix.

v' = M*v

The vertex coords can be treated as a 4:1 column matrix when you do the multiplication.

ie: [x y z 1]t

[edited by - benjamin bunny on May 14, 2003 8:13:51 PM]
Nemesis2k2
Nemesis2k2
quote:
perhaps extract the matrix from OpenGL, using glGetMatrix()? (I think that''s the function..)

Not quite. It''s
glGetFloatv(GL_MODELVIEW_MATRIX, parray); 

where parray is a pointer to a float [16] array to store the returned matrix.

Tron3k
Tron3k
It''s coming out on Thursday.

Oh you mean THAT matrix ...
“[The clergy] believe that any portion of power confided to me, will be exerted in opposition to their schemes. And they believe rightly: for I have sworn upon the altar of God, eternal hostility against every form of tyranny over the mind of man” - Thomas Jefferson

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.