I’d like to ask a few questions, because I’m fairly new to Java and I don’t know if I’m doing everything correctly.
I’m trying to build an applet which is graphics-heavy. By this, I mean I’m loading 6 2048x2048 24 bit png textures on the screen, as well as a 512x512 32 bit tga texture. What I need to do is when I click somewhere on one of my textures, the program zooms in to that spot.
To accomplish that I manipulate the camera using gluLookAt and change the values. I also change the view frustum like:
gl.glMatrixMode(GL.GL_PROJECTION);
gl.glLoadIdentity();
gl.glOrtho(-zoomWidth, zoomWidth, -zoomHeight, zoomHeight, -10, 10);
gl.glMatrixMode(GL.GL_MODELVIEW);
gl.glLoadIdentity();
Everything was good up to that point. Then I thought, I’d add a smooth animation, so when the user clicks on a spot, the camera and the view frustum gradually “move” to that point. The problem with this approach is that it seems pretty slow. I tried putting a timer to get the FPS like this:
framesPerSecond++;
currentFrameTime = System.currentTimeMillis();
if ((currentFrameTime - previousFrameTime) > 6000) {
System.out.println("FPS: " + framesPerSecond);
previousFrameTime = currentFrameTime;
framesPerSecond = 0;
}
in my display callback. It shows that I get 55 to 60 fps (I’ve got a loaned ATI Radeon 9600 w/ 256MB of memory).
But if I’m getting 55 to 60 fps, why my display is slow? Am I missing something here? Another thing to note is that the fps println comes every 4-5 seconds. Why is that?
I forgot to mention that my applet runs on a thread.
Sorry for the long post, but there seems to be something fundamental that I’m missing here.