Cameras & Renderables
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?
You need to multiply objects world space matrix with inverse of cameras matrix.
Something like:
Something like:
glLoadMatrix( camera.matrix.Inverse() );for each Renderable r { glPushMatrix(); glMultMatrix( r.matrix ); render r glPopMatrix();}
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement