Hi all,
I have a “little” problem. I want a sphere to move after a certain event occures. Every time that event occures the display method is called but I only see the movement if I resize the OpenGLContainer. And if I manually call the repaint method of the container it ends up in a loop!
Can somebody please give me a hint ?
Here some code:
public void display(GLDrawable drawable)
{
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
drawSphere(azimutArray[o],rangeArray[o]);
if(o<4) o++;
}
private void drawSphere(double angle,double range)
{
gl.glLoadIdentity();
gl.glRotated(angle, 0, 0, 1.0);
gl.glTranslated(range, 0.0, -6.0);
gl.glNewList(10,GL.GL_COMPILE); //Beginn der Listendefinition
glu.gluQuadricTexture(sphere,false); //auf Texturnutzung nicht vorbereiten!
glu.gluQuadricOrientation(sphere,GLU.GLU_OUTSIDE); //Normalenausrichtung nach Aussen
glu.gluQuadricDrawStyle(sphere,GLU.GLU_FILL); //Darstellungsart, ausgefüllt darst.
glu.gluQuadricNormals(sphere,GLU.GLU_FLAT); //Normalen für jede FLäche berechnen
gl.glPolygonMode(GL.GL_FRONT,GL.GL_FILL);//Vorderflächendarst.
gl.glShadeModel(GL.GL_SMOOTH); //Schattierungsmodus
gl.glColor4fv(setColor_RED());
glu.gluSphere(sphere, 0.1, 50, 50); //Kugelbefehlsaufruf, Radius zuweisen, 18 Längenaufteilung, 9 Breitenaufteil.
gl.glEndList(); //Ende der Listendefinition
gl.glCallList(10);
gl.glFlush();
}