Camera "gluperspective" question?

i’m trying to make a 3d game with a birds eye 2d view during gameplay, i have set the view as follows:-

//      Calculate The Aspect Ratio Of The Window, 3d camera
        GLU.gluPerspective(
                  45.0f,
                  (float)640 / (float) 480, // these being screen width and height
                  0.1f,
                  1000.0f);
                GL11.glMatrixMode(GL11.GL_MODELVIEW); // Select The Modelview Matrix
                
                GL11.glLoadIdentity();
                
                GLU.gluLookAt(320.0f,240.0f,600.0f,  // camera pos
                                                     320.0f,240.0f,0.0f, // camera target
                                                         0.0f,1.0f,0.0f); // camera tilt

i have a box in the middle of the screen, the thing is when the object moves left or right on the screen i begin to see the sides of the object the futher it moves away from the centre of the screen, i know this is normal for 3d but i was hopeing if there was a way to reduce this so the sides don’t show so much and i get more of a 2d style feel?

thx

If you don’t want any 3d effect you can use ortho mode. If you wan’t to reduce the 3d effect you reduce the first parameter to gluPerspective. Try 45.5f/2f as an example. This will give you a narrower frustum and you will look like it was zoomed in. To overcome this you have to move the camera back to compensate.

edit: You could also look at glFrustum for a different way of setting up the perspecive projection.

yeah i just want to reduce the 3d effect, i’ll try that. :wink:

i’ve got the sort of angle i was after about 10, but the thing is i have to nearly zoom the camera back by like 3000.0f units, would this have any impact on the overall performance or is it ok, if it does is there a better way to achieve this?

thanks

There is no speed penalty, but you must remember to increase the near clipping plane or you can end up with lack of precision in the z buffer. You could try setting the near clipping plane to 1000.