Can you help me fix perspective

Hi,

I’m trying to translate from my C code and just not able to get any perspective. I have the following pSetView function, may be someone can spot an egregious error. Sorry that it is out of context!

public void pSetView(double inAspect, GLDrawable inDrawable, boolean inFlip) {
GL gl = inDrawable.getGL();
GLU glu = inDrawable.getGLU();

gl.glMatrixMode(GL.GL_PROJECTION);
gl.glLoadIdentity();

if (myPerspectivePresent)
  glu.gluPerspective(myPersp*Math.PI, inAspect, myFrontClipping, 100000.0);
else
  gl.glOrtho(-myZoom * inAspect, myZoom * inAspect, -myZoom, myZoom, -10.0, 100.0);


gl.glMatrixMode(GL.GL_MODELVIEW);
gl.glLoadIdentity();
double theta = myTheta * Math.PI;
double phi = myPhi * Math.PI;
double upOrDown = 1 - 2 * (int) (pMod(theta, 2 * Math.PI) / Math.PI);
glu.gluLookAt(
              myZoom*Math.sin(theta)*Math.cos(phi),
              myZoom*Math.sin(theta)*Math.sin(phi), 
              myZoom*Math.cos(theta),
              0.0, 0.0, 0.0,
              0.0, 0.0, (!inFlip)?upOrDown:-upOrDown);

}

Very many thanks in advance!

Pahidla

What is the value of myPersp?

Thank you.

The old radians vs degrees problem!!!

Check out Nate Robin’s OpenGL tutor:
http://www.xmission.com/~nate/tutors.html

It has a demo that shows you exactly
how projection works and you can adjust
the parameters in real-time.