Jump to content
  • Advertisement
Sign in to follow this  
digsydave

OpenGL opengl camera

This topic is 4067 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 have a 3d environment written in opengl and c++. The camera at the moment can only move forwards backwards left right up and down but it cant pivot to the left and go that way etc so its only fixed looking and moving in one direction. I was given the code sqrtf(x * x + y * y + z * z); a while ago to find the length of a vector but im not sure what to do with it and how to apply it to the camera :( any suggestions or pointers in the right direction would be greatly appreciated!

Share this post


Link to post
Share on other sites
Advertisement
You should use gluLookAt.


gluLookAt(cam.x, cam.y, cam.z, lookat.x, lookat.y, lookat.z, up.x, up.y, up.z);



With some basic math using sine and cosine you'll be able to create a camera that can move and rotate around the Y axis.

Share this post


Link to post
Share on other sites
Or you could loop on these forums for the dozens or more OpenGL Camera discussions that have taken place and look at their code examples on how to do it properly.

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!