Sign in to follow this  
Noxir

omg

Recommended Posts

Anyone knows how to make the screen follow the player? I tried glTranslatef(mapx, mapy, mapz) and then I moved the map when the player were moving but it aint working it's totally weird somebody help me or give me a code or tutorial plz plz plz :/

Share this post


Link to post
Share on other sites
You're a posting machine! Consider making 1 post with several questions :P

glTranslatef(); is only for translating poly's I believe.

until someone more compitant posts, you could try making the perimeters for the function gluLookAt(); be attached to your character's movement. I'm not really sure if that'll work, but it'll give you something to try :)

I myself haven't been able to get gluLookAt(); to work inside the gldrawscene loop, so for all I know it's probably impossible.

Another promising function you might want to look at is gluPerspective(); Again, i'm not sure what that one does, but the name gives me images of what it MIGHT do ;)

Share this post


Link to post
Share on other sites
You'll find the typical camera, and gluLookAt(), will actually move the world around the camera rather than the camera around the world. It does seem weird and takes a lot of explaining so I won't bother. However, if you put glTranslatef(-mapx, -mapy, -mapz) before you do any of your drawing it will draw the netire world offset so as to make it look like the camera has moved. Take note that there is a '-' before the values as moveing the world to the left, makes it look like the camera has moved to the right so you pass the reverse values of where you want the camera to be.

As a side note, and following on from the previous poster, might I suggest you try make your post titles more appropriate in future. Many people completely ignore such threads purely because of the title so it's in your best interest to ensure your posts are clear and polite.

Hope that was of some use.

Share this post


Link to post
Share on other sites
Quote:
Original post by ghosted
You'll find the typical camera, and gluLookAt(), will actually move the world around the camera rather than the camera around the world. It does seem weird and takes a lot of explaining so I won't bother. However, if you put glTranslatef(-mapx, -mapy, -mapz) before you do any of your drawing it will draw the netire world offset so as to make it look like the camera has moved. Take note that there is a '-' before the values as moveing the world to the left, makes it look like the camera has moved to the right so you pass the reverse values of where you want the camera to be.

As a side note, and following on from the previous poster, might I suggest you try make your post titles more appropriate in future. Many people completely ignore such threads purely because of the title so it's in your best interest to ensure your posts are clear and polite.

Hope that was of some use.


Thanks, I will :)

Share this post


Link to post
Share on other sites
[Quote]
You'll find the typical camera, and gluLookAt(), will actually move the world around the camera rather than the camera around the world. It does seem weird and takes a lot of explaining so I won't bother. However, if you put glTranslatef(-mapx, -mapy, -mapz) before you do any of your drawing it will draw the netire world offset so as to make it look like the camera has moved. Take note that there is a '-' before the values as moveing the world to the left, makes it look like the camera has moved to the right so you pass the reverse values of where you want the camera to be.

As a side note, and following on from the previous poster, might I suggest you try make your post titles more appropriate in future. Many people completely ignore such threads purely because of the title so it's in your best interest to ensure your posts are clear and polite.

Hope that was of some use.
[\Quote]

Uh that is explained in the last year of school (GCSE's) under the Vector or with the quadratics when working with y axis cuts....

But in reality its quite logic.
Yes glTranslate,Rotate,Scale all apply only to the Polygons not to the camera but..
Translating the Camera is the same as inversly translating the world
ie
glTranslate(-cam) // translates all polygons the cameras negative position
// now because of relativity we can say that the correct polygons move towards the camera or the camera moves towards the polygons

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this