Login  Register

GLCanvas/GLJPanel problems

Posted by mikaelhc on Nov 13, 2012; 3:41pm
URL: https://forum.jogamp.org/GLCanvas-GLJPanel-problems-tp4026923.html

Hi,

I'm working on porting some OpenGL/C++ code to JOGL.

First, I started out using the GLCanvas, and things worked fine - until V2.0-rc11.

Now, my GLCanvas is part of JSplitPane, and when I change the split, I get a:

javax.media.opengl.GLException: Unable to create temp OpenGL context for device context 0x4e0138c3
        at jogamp.common.awt.AWTEDTExecutor.invoke(AWTEDTExecutor.java:58)
       
This happens shortly after dispose(...) is called. This used to work on V2.0-rc10. The crash only happens on Windows, not on Mac.

Now, I tried switching to GLJPanel, and the code works again (probably because dispose() is no longer called when moving the split).

But GLJPanel has other issues:

When using GLCanvas, I get close to 60FPS no matter what the windows size is (even I use a FPSAnimator with higher target FPS, the FPS seems capped to 60FPS).

When using GLJPanel, I get around ~100FPS for a small window sizes, but for large panel sizes, the frame rate decreases down to ~30 FPS. Even with no drawing operations.

My questions:

1) What can I do to avoid the exception, when using GLCanvas? (This is only present on Windows)
2) Why does the frame rate fall when enlargening the window, when using GLJPanel? (This happens on both Windows and Mac)
3) What is the prefered component, GLCanvas or GLJPanel? I need to use it in an application with lots of Swing components.


Best regards, Mikael.