Login  Register

GLException "Unable to create temp OpenGL context for device context" thrown when GLContext.makeCurrent() called

Posted by stepasite on Sep 10, 2012; 3:26pm
URL: https://forum.jogamp.org/GLException-Unable-to-create-temp-OpenGL-context-for-device-context-thrown-when-GLContext-makeCurrend-tp4026068.html

Hi,

I am migrating from JOGL to JOGL2, but my code does not work with JOGL2.

I use my own class for rendering, it is descendant of GLCanvas. Here is the code which produces GLException:

public void addNotify()
{
  super.addNotify();
  GLContext context = getContext();
  context.makeCurrent(); // GLException is thrown
}

When my component is added to hierarchy (addNotify() is invoked on EDT), attempt to make a context current does not suffice, but GLException "Unable to create temp OpenGL context for device context" is thrown.

Removing the line:

context.makeCurrent()

from the source code does help, but I can't do this because of GLContext sharing (if multiple instances of my rendering class exist, the context is not shared when the line above is commented).

Does anyone struggle with the similar problem? Any help much or proposed solution much appreciated.

Thanks is advance,
Pavel