Jump to content
  • Advertisement
Sign in to follow this  
Quicky

i have asked this hundreds of times, but i'll ask it again...

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

Advertisement
There is no glLookAt function. Assuming you meant gluLookAt, this is a utility function for building a view matrix. The first three parameters give the location of the virtual camera in world-space. The next three parameters give the location of the camera's target in world-space. The final three parameters are the "up vector" and specify a vector which the top of the viewing volume will "reach towards". For more information, see the gluLookAt manpage.

Share this post


Link to post
Share on other sites
Thanks, i ment gluLookAt(/)-function, someday i'll will tell these things to beginners... =)

thanks i will...

Share this post


Link to post
Share on other sites
or i mean, which is better to do a working camera, that i am going to make a game.

i use glTranslatef()-function but i couldn't use gluLookAt because it very hard to use...

so which i should use to get a good camera...

Share this post


Link to post
Share on other sites
Usually in games, you don't move the camera. Yes it sounds wierd, but instead you move the entire world around the character. So if you "turn right" the world actually turns left. It doesn't really matter, moving the camera or moving the world, it's all relative, and there is no way to tell the difference. To set up the camera, use gluLookAt, point it at the origin, and then change your Y and Z values to like 10 or something. Otherwise, it's a little more complicated. Say you have a 3rd person camera that is always viewing from the back. You turn to the left. Now your character is rotating left, and you have to do some sin/cos operations to figure out your cameras new z/x position so that you rotate with the character. It's easier just to rotate the world with glRotatef. ;)

Share this post


Link to post
Share on other sites
I would advise you not to use gluLookAt() for a 1st-person camera, except for the specific task of positioning the camera and aiming it toward a target.

Share this post


Link to post
Share on other sites
to IgnisDeus:
i think it's much easier translating and rotating the camera view instead of moving the whole world. complex worlds can contain about thousands of vertices and hundreds of entities. If try to operate on every of these every frame, this will be a slowdown...

Share this post


Link to post
Share on other sites
Quote:
Original post by IgnisDeus
Usually in games, you don't move the camera. Yes it sounds wierd, but instead you move the entire world around the character. So if you "turn right" the world actually turns left. It doesn't really matter, moving the camera or moving the world, it's all relative, and there is no way to tell the difference. To set up the camera, use gluLookAt, point it at the origin, and then change your Y and Z values to like 10 or something. Otherwise, it's a little more complicated. Say you have a 3rd person camera that is always viewing from the back. You turn to the left. Now your character is rotating left, and you have to do some sin/cos operations to figure out your cameras new z/x position so that you rotate with the character. It's easier just to rotate the world with glRotatef. ;)


This isn't too common of a practice in modern games. A 3rd person camera is not that hard to create.

Share this post


Link to post
Share on other sites
Quote:
i think it's much easier translating and rotating the camera view instead of moving the whole world. complex worlds can contain about thousands of vertices and hundreds of entities. If try to operate on every of these every frame, this will be a slowdown...
I think you might be misunderstanding the OpenGL pipeline. At least as far as OpenGL is concerned, whether you move the world or camera is purely a conceptual issue and has nothing to do with performance.

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!