how I am new to OpenGL and especally with JOGL. I currently try to learn JOGL. I dont like to create a special thread that runs the display method of my window, so I called it manually.
public static void main(String[] args)
{
GLProfile.initSingleton();
GLProfile glp = GLProfile.get(GLProfile.GL2);
GLCapabilities caps = new GLCapabilities(glp);
GLWindow window = GLWindow.create(caps);
window.setSize(800, 480);
window.setTitle("Test");
window.setVisible(true);
boolean isRunning = true;
while(isRunning )
{
window.display();
}
}
That works pretty fine, but now I dont know, how I can draw something on the window, without adding a "addGLEventListener". I tried a lot of stuff like this...
while(isRunning )
{
GL2 gl = window.getGL().getGL2();
gl.glClear(GL.GL_COLOR_BUFFER_BIT);
gl.glLoadIdentity();
gl.glBegin(GL.GL_TRIANGLES);
gl.glColor3f(1, 0, 0);
gl.glVertex2d(-0.1, -0.1);
gl.glColor3f(0, 1, 0);
gl.glVertex2d(0, 0.1);
gl.glColor3f(0, 0, 1);
gl.glVertex2d(0.1, -0.1);
gl.glEnd();
window.display();
}
But this not works. I hope someone know how I can use JOGL so. The reason why I want to do this is, that I want to program me a small game framwork/JOGL wrapper. And there is the normal way not very good, at least for beginners.