Java: openGL: JOGL: What happens behind the scenes when I call the display () method?

I have this line of code:

renderableObject.renderObject(gl, glu);

This leads to a large list of objects displayed by openGL, however it only works when used as follows:

@Override
public void display(GLAutoDrawable drawable)
    {               
        renderableObject.renderObject(gl, glu);
    }

If I call a line outside the overridden display method, I get an exception message because there is no glContext in the current thread, in fact, if I call any gl draw commands outside this method, I get the same exception

Now, ideally, I want to create many display lists once, and then render each frame with an odd display list, which will be periodically recreated. However, I need to go through this single display () method, which means that I would have to test every frame if the display list was created or needs to be changed, etc. 60 times per second! what kind of processing power, when I could process them separately, when necessary.

Thus, no matter what the display () method calls, I would like to be able to replicate it, which allowed me to create many of my own display methods without going through this method for everything!

So, is there a simple gl call that I can make myself?

+5
1

, .

, , GLCanvas , JOGL . GLContext GLCanvas . , , . GLContext, , GL, , . , GLContext , , GL .

JOGL . GLEventListener display() , GL GLAutoDrawable . , , Graphics2D paint(). Java- - ; . , , Java2D: invalidate(). ( , , , display(), GL GLAutoDrawable ).

GLContext , . .

+2

All Articles