Jump to content
  • Advertisement
Sign in to follow this  
operat0r

OpenGL manually coordinate transformation

This topic is 3784 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

(Sorry for my english ...) Hi, This is my first post in this forum, nice to met you. I´m having some problem with matrix transformation. I need to draw one point with matrix rotation and translation, after this I would like to draw another point in exactly the same place but with no Gl matrix rotation or translation. So I think I need to load GlModelview matrix (with rotation or translation) and multiplication it with my point coordinates ... I´m trying but with no success This is my code: PushMatrix(); Translate(antena.X, 0, 0); Translate(0, antena.Y, 0); Rotate(rotation, false, false, true); Translate(-antena.X, 0, 0); Translate(0, -antena.Y, 0); Now I draw one point with this coordinates: double[] point1 = { 1, 2, 3 }; ...Now I need to backup OpenGL matrix to procced with Matrix multiplication ... double[] modelview = new double[16]; Gl.glGetDoublev(Gl.GL_MODELVIEW_MATRIX, modelview); double[][] modelviewOut = new double[4][]; modelviewOut[0] = new double[4]; modelviewOut[1] = new double[4]; modelviewOut[2] = new double[4]; modelviewOut[3] = new double[4]; int x = 0; for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { modelviewOut[j] = modelview[x]; x++; } } ...some code ... PopMatrix(); Now I need to draw one coordinate in the same place that point1 with no GlRotation. I think I need to multiply my point1 = { 1, 2, 3 } array matrix by OpenGL ModelView matrix (modelviewOut). Is this aproach correct? I not, how can I do this?? thanks in advance Operator

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!