Jump to content
  • Advertisement
Sign in to follow this  
Karmux

OpenGL Rotating camera matrix

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

Hello,

I'm porting my renderer from OpenGL 2.1 to OpenGL 3 and run into difficulties with rotating a camera.
When I try to rotate camera, it rotates the model independently from camera position (looks like dependently from 0,0,0 position).

My rendering pipeline:
* calculate perspective and set model and view matrices to identity
* load model
for every frame {
* clear scene
* rotate and move the camera ([s]view matrix = rotatex*rotatey*translate[/s])
* bind shader
* pass projection, model (still identity) and view matrices to the shader
* draw model (pass vertices, normals etc to shader)
* unbind shader
* swap buffers
}


Could anybody tell what's wrong here? If everything looks right here then I have to recheck my translate and rotate functions.

EDIT: Solved!

view matrix = translate * rotatex * rotatey

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.

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!