Sign in to follow this  

Cameras & Renderables

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

This topic is 4841 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this