Skip to main content
GameDev.net gamedev.net
🔒 Locked

glulookat help.

Started by fishleg003 Oct 30, 2005 at 8:50 AM 3 replies 800+ views
Original Post
fishleg003
fishleg003
Im trying to make a 2D scrolling shooter game but i want to be able to use the z axis so i can have a 3D background. This is using glulootat i position the camera at 0 0 2 looking at 0, 0, 0 and i get this picture but the problem is i want to be sat directly at 0, 0, 0 looking down the z axis. I tried doing GluLookat(0,0,0,0,0,0,0,1,0) but nothing displays. I settup perspective using, aspect=(float)width/(float)height; gluPerspective(60, aspect, 1, 5000); Image hosted by Photobucket.com The 2 lines circled are coming from -1 in the z to +1 as you can see they dont look right. They should appear as a straight line like in the glortho image below this is so i can have enemies coming from the far distance that fly over the player. Gluortho this is what i want it to look like but if i do it using gluortho the appearance of 3d goes out the window. glOrtho(-1, 1, -1, 1, -1, 1); Image hosted by Photobucket.com Im not sure how to keep everything mapped to the image window ive made everything within the range -1 to 1 but how do i make it so that the top right of the image window is 1,1 and the bottom left is -1 -1. thx alot for any advice
metalcrusader
metalcrusader
GluLookat(0,0,0,0,0,0,0,1,0) doesn´t work because the point from where you are looking must be different to the point to where you want to look. For example GluLookat(0,0,3, 0,0,0 ,0,1,0) or GluLookat( 0,0,0, 0,0,-1, 0,1,0).
fishleg003
fishleg003
Yes i can do that but now im centered in the middle i want to be able to view the whole box when im sat at 0, 0, 0 not just the center bit.

thx again
kburkhart84
kburkhart84
Then you have to move the box farther along the z axis. I recommend that if it works how you have it, why do you want to change it.


Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.