In my scene a polarcoordinatesystem with several objects on it is displayed. My animator runs with 10fps. The reason why I did profiling was that if I zoom into the scene by decreasing the clipsize the cpu preformance rises to nearly 100%!
Heres some code:
-for zooming:
/**
* With this method zooming is realised.
* @param factor <0 -> zoom in, >0 -> zoom out
*/
public void zoom(int factor)
{
this.clipSize += clipSize * 0.1 * factor;
System.out.println("ClipSize = " + this.clipSize);
}
-display-method of my GLEventListener :
public void display(GLDrawable drawable)
{
gl.glGetDoublev(GL.GL_MODELVIEW_MATRIX, model_view);
gl.glGetDoublev(GL.GL_PROJECTION_MATRIX, projection);
gl.glGetIntegerv(GL.GL_VIEWPORT, viewport);
if (locateCenterFlag)
{
locateCenterPoint();
this.xVector = 0;
this.yVector = 0;
}
else
{
glu.gluUnProject(
this.centerX[0] + this.xVector,
this.centerY[0] + this.yVector,
this.centerZ[0] + this.zVector,
model_view,
projection,
viewport,
worldX,
worldY,
worldZ);
setSceneCenterPoint(worldY[0] * (-1), worldX[0] * (-1), 0.0);
}
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
gl.glMatrixMode(GL.GL_PROJECTION);
gl.glLoadIdentity();
gl.glOrtho(-clipSize,+clipSize,-clipSize,+clipSize,-clipSize * 100,+clipSize * 100);
glu.gluLookAt(camPos[0],camPos[1],camPos[2],0.0,0.0,0.0,0.0,1.0,0.0);
//Kamera irgendwo auf Z-Achse über (<clipsize) Ursprung
gl.glMatrixMode(GL.GL_MODELVIEW);
gl.glLoadIdentity();
this.id = 0;
this.gl.glColor4d(1.0,0.0,0.0,1.0);
showMousePos(this.mouseX,this.mouseY);
this.gl.glFlush();
drawTargets();
this.gl.glFlush();
drawCOSystem();
this.gl.glFlush();
drawZoomCross();
this.gl.glFlush();
if (this.pick)
{
select();
}
this.gl.glFlush();
}