Login  Register

GLJPanel and displaying with a minimized window

classic Classic list List threaded Threaded
6 messages Options Options
Embed post
Permalink
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

GLJPanel and displaying with a minimized window

r.jaoui
26 posts
Hi all !

In a recent project, I have a small issue with Swing-based JOGL.

Basically, I want the program to keep runing (as in : keep launching the display() function when panel.repaint() is called) even when the window is minimized (in the task bar).

For now, eveything works, as in the rendering works when the window is visible, whether focused or not, but not when minimized.

My setup is :
- a GLJPanel linked to a GLEventListener.
- a run() function that every 10ms or so calls panel.repaint(), which then internally calls the GLEventListener's display(GLAutoDrawable displayable) function, on which the screen is rendered.

Here is the GLJPanel construction script :

PROFILE = GLProfile.get(GLProfile.GL2);

CAPABILITIES = new GLCapabilities(PROFILE);
CAPABILITIES.setSampleBuffers(true);
CAPABILITIES.setNumSamples(currentAntialiasingLevel);
CAPABILITIES.setStencilBits(8);
CAPABILITIES.setPBuffer(true);

panel = new GLJPanel(CAPABILITIES);
listener = new SPanelListener(this, panel);
panel.addGLEventListener(listener);

panel.setSize(width, height);

frame = new SFrame(this, width, height);


and here is the SFrame constructor (that extends JFrame) :

super();
this.context = context;

this.setVisible(true);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setSize(width, height);

context.focused = this.isFocused();
focusListener = new SFocusListener(context);
this.addFocusListener(focusListener);

this.setContentPane(context.getPanel());


Note that I know that the panel.repaint() function is called when minimized, only the subsequent display() function is not.

Does anyone have any lead ? Thanks !
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: GLJPanel and displaying with a minimized window

gouessej
Administrator
6038 posts
Why not using offscreen rendering?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: GLJPanel and displaying with a minimized window

r.jaoui
26 posts
In this specific project I'm already using Render-to-Texture, and as far as I understand, off-screen rendering basically works the same but by attaching RenderBuffers to the FrameBuffer (right?).

If so, since the display() function itself isn't called, how can the image be rendered, even off-screen? If the display() function were to be called but an error message was raised then I'd understand why using off-screen rendering, but in this case since the display() function altogether isn't called, I can't even tell OpenGL to perform off-screen rendering (btw, I'm actually planning to use off-screen rendering later on, so it will be implemented later on anyways, I just want to be sure that it will be able to solve the issue).

The issue is that the display function also holds all the processing that needs to be done at each frame, and that includes non-rendering operations that need to be made whether the screen is rendered or not.

Thank you for the help :)
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: GLJPanel and displaying with a minimized window

gouessej
Administrator
6038 posts
You can call GLAutoDrawable.display() directly.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: GLJPanel and displaying with a minimized window

r.jaoui
26 posts
Oh I didn't know that but yep, works wonders, thank you so much :)
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: GLJPanel and displaying with a minimized window

gouessej
Administrator
6038 posts
You're welcome.
Julien Gouesse | Personal blog | Website