0

In my JOGL program, I have an object at (0,0,0). I am using spherical coordinates to modify angles theta(inclination) and phi(rotation) to view my object at origin, but I am not able to view it properly. Sometimes the object becomes invisible at some angles, and i am not able to view from all angles.

Here is my code:

void decTheta() 
{        
    theta--;
    ex = distance*Math.sin(Math.toRadians(theta))*Math.cos(Math.toRadians(phi));
    ez = distance*Math.sin(Math.toRadians(theta))*Math.sin(Math.toRadians(phi));
    ey = distance*Math.cos(Math.toRadians(theta));
}

void incTheta()
{
    theta++;
    ex = distance*Math.sin(Math.toRadians(theta))*Math.cos(Math.toRadians(phi));
    ez = distance*Math.sin(Math.toRadians(theta))*Math.sin(Math.toRadians(phi));
    ey = distance*Math.cos(Math.toRadians(theta));
}

void incPhi() 
{
    phi++;    
    ex = distance*Math.sin(Math.toRadians(theta))*Math.cos(Math.toRadians(phi));
    ez = distance*Math.sin(Math.toRadians(theta))*Math.sin(Math.toRadians(phi));
    ey = distance*Math.cos(Math.toRadians(theta));
}

void decPhi() 
{
    phi--;
    ex = distance*Math.sin(Math.toRadians(theta))*Math.cos(Math.toRadians(phi));
    ez = distance*Math.sin(Math.toRadians(theta))*Math.sin(Math.toRadians(phi));
    ey = distance*Math.cos(Math.toRadians(theta));
}

What am I doing wrong?

TylerH
  • 20,799
  • 66
  • 75
  • 101
Madeyedexter
  • 1,155
  • 2
  • 17
  • 33

1 Answers1

0

Your object must be entirely inside your frustum if you want to see it correctly and completely. Modify your (perspective or orthogonal) projection matrix to make it work. I remind you that the use of JOGL 2 requires a real understanding of the OpenGL basics.

gouessej
  • 3,640
  • 3
  • 33
  • 67