Hi,
I’m new to OpenGL and JOGL…
I’ve got a GLJPanel (400x400) to render, with a GLEventListener attached to it. I have a
while( true ){ panel.display(); }
and my Listener has (stripped out basics):
init(){
gl.glViewport(0, 0, 200, 200);
gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
}
display(){
gl.glRotatef( 0.6f, 0.0f,0.0f,1.0f );
gl.glBegin( GL.GL_QUADS );
gl.glColor3f(1.0f,0.1f,0.1f);
gl.glVertex3f(-0.6f,-0.6f,0.0f);
gl.glColor3f(0.1f,0.1f,0.1f);
gl.glVertex3f(0.6f,-0.6f,0.0f);
gl.glColor3f(0.1f,0.1f,1.0f);
gl.glVertex3f(0.6f,0.6f,0.0f);
gl.glColor3f(1.0f,0.1f,1.0f);
gl.glVertex3f(-0.6f,0.6f,0.0f);
gl.glEnd();
}
But all I get is a black Panel with nothing in it…
When I add a
gl.glTranslatef(0.0f, 0.0f,-0.1f);
The quad will show up after about 100 frames…
It seems that at first the quad is bigger than the frame and can’t be displayed…
Where did I make the mistake ?
Thanks a lot !
Peter