Jump to content
  • Advertisement
Sign in to follow this  
vraim

OpenGL OpenGL matrix on CPU.

This topic is 4329 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, I got such situation. I got an object in OpenGL list with many points. What I'm truing to do is to select few points with an P5 glove. So this is what I do: 1. get clear VIEW matrix (called viewM) glMatrixMode(GL_MODELVIEW); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); 2. get full MODELVIEW matrix, after all tranformations (called mr) 3. invert the VIEW matrix (called invViewM) 4. getting MODEL matrix by multiplying mr * invViewM (called modelM) 5. invert modelM (called mb) 6. gettin' new points values by: selX0 = (((mb[0]*selX0)+(mb[4]*selX0)+(mb[8]*selX0)+(mb[12]*selX0))); selY0 = (((mb[1]*selY0)+(mb[5]*selY0)+(mb[9]*selY0)+(mb[13]*selY0))); selZ0 = (((mb[2]*selZ0)+(mb[6]*selZ0)+(mb[10]*selZ0)+(mb[14]*selZ0))); My problem is that I get the center of my object transform it to the center of world and rotate. While selecting I'm using two points, but they are in the center of world. After pressing the key I would like to reload the list and colorize the selected points. The problem is that it works fine but without rotations. Did I lost something on the way?

Share this post


Link to post
Share on other sites
Advertisement
It's not clear to me. In what space is selX0, selY0, selZ0?
mr * invViewM doesn't make sense.

Part 6 also looks wrong, if that's suppose to be matrix * vector.

Share this post


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

  • 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!