Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

StiNKy

3d camera

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

How can I do a 1st person view so the user can move forward in the exact direction they are looking at? without using freaking glu commands??? All the damn results for what I''m looking for is glu this, glu that. Some people don''t want to freaking use glu! Thanks in advanced.

Share this post


Link to post
Share on other sites
Advertisement
Cause I''m trying to write an engine using nothing but gl, ie no glu, no glut, nothing else but your standard gl. Working damn well so far.... Surely there IS a way.

Share this post


Link to post
Share on other sites
glu is standard gl. It''s supported by the maintainers of OpenGL. it *is* gl. Why would you not want to use it??

With that said, some not-too-complex matrix math will give you your very own lookAt function. use gramm-schmidt orthonormalization to get three orthogonal unit vectors from your passed-in two(eye to target, and eye to up), make ''em into a matrix, and then use the eyepoint as a translation.

Share this post


Link to post
Share on other sites
Well, this seems to be working for me so far:
glRotatef(rot.X, 0.1f, 0.0f, 0.0f);
glRotatef(rot.Y, 0.0f, 0.1f, 0.0f);
with rot.X being how much to rotate around the X axis, and rot.Y how much around the Y axis.
But if I''m storing the position at pos.X, pos.Y, and pos.Z how can I modify the pos.X, pos.Y, and pos.Z values so it moves forward in the world to exactly where the user is looking at? You can''t do that with gluLookAt()

Share this post


Link to post
Share on other sites
easy find the direction the person is looking at
Dir = camera/person(first person) direction
cam = camera/person
gluLookAt( cam.x, cam.y, cam.z, cam.x+dir.x, cam.y+dir.y, cam.z+dir.z, 0,1,0 );

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I don''t like gluLookAt, glRotate, glTranslate, whatever. I compute my own camera matrix and load it via glLoadMatrix(), that''s it.

Share this post


Link to post
Share on other sites
glRotatef(camera.yaw, 1, 0, 0);
glRotatef(camera.pitch, 0, 1, 0);
glRotatef(camera.roll, 0, 0, 1);
glTranslatef(-camera.x, -camera.y, -camera.z);

Share this post


Link to post
Share on other sites

  • 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!