Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

jtrubridge

Open GL - Getting 3D position

This topic is 5228 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all, I''m pretty new to Open GL. I''m drawing vertices which are drawn after a serious of matrices have been applied. Do you know how I get the position in the ''global space'' of the vertices I''m drawing. glPushMatrix(); glTranslatef(m[f][0],m[f][1],m[f][2]);//1 transform(m[f][3],m[f][4],m[f][5]);//2 glPushMatrix(); drawBone(o[3], o[4], o[5], 1);//B transform(m[f][6],m[f][7],m[f][8]);// and in drawBone glBegin(GL_TRIANGLES); glNormal3f(0.00, 0.00, -1.00); glVertex3f(0,0,0); glVertex3f(x-1.5, y+0.2, z-0.5); glVertex3f(x+1.5, y+0.2, z-0.5); glEnd(); How do I get the position of the 3 vertices in world space? I need these values so I can do some maths calculations. Many thanks Jam

Share this post


Link to post
Share on other sites
Advertisement
You must get modelview matrix from opengl
glGetFloatv(GL_MODELVIEW_MATRIX,&data);
In data is transformatian that you need, so mul data with vertex and u got what u need.


Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!