Jump to content
  • Advertisement
Sign in to follow this  
Darkor

Cameras & Renderables

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

I feel like I've coded myself into a corner once again. See, I've been working on a 3D engine that's based loosely on how OGRE does things. I now have a render function which grabs renderables from a queue and displays them. Each renderable stores a single world transform matrix which is loaded before rendering. I am now trying to create a Camera class and this forms a big problem because no matter where I locate my camera too, the renderable world matrix transforms it to the same location every time with respect to the Camera. At least, that is what I think the problem is. How would one go about solving this problem?

Share this post


Link to post
Share on other sites
Advertisement
You need to multiply objects world space matrix with inverse of cameras matrix.

Something like:

glLoadMatrix( camera.matrix.Inverse() );
for each Renderable r {
glPushMatrix();
glMultMatrix( r.matrix );
render r
glPopMatrix();
}

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!