Login  Register

Re: NPE when getting GLDrawableFactory

Posted by François Coupal on Mar 07, 2011; 5:36pm
URL: https://forum.jogamp.org/NPE-when-getting-GLDrawableFactory-tp2276026p2647089.html

I fiddled around the source code for the VersionApplet program, with Sven direction about the source code

> The only requirement here is that the shared resources for the target device
> have been initialized.
> In short: 'GLProfile.initSingleton(false);' shall be passed.
>
> http://jogamp.org/git/?p=jogl.git;a=blob;f=src/newt/classes/jogamp/newt/awt/opengl/VersionApplet.java;h=18524d0bac330afbd04a425720d548170da84de7;hb=HEAD#l103
>
> // shortcut:
> GLProfile.initSingleton(false);
> List/*<GLCapabilitiesImmutable>*/ availCaps =  GLDrawableFactory.getDesktopFactory().getAvailableCapabilities(null);

I tested this, and this is not the info I am looking for, although it does work. The content of such a list are like this:

GLCaps[0x21 0x75: on-scr, rgba 8/8/8/0, opaque, accum-rgba 16/16/16/16, dp/st/ms: 24/8/0, dbl, mono  , hw, GLProfile[GL2/GL2]]
GLCaps[0x21 0x75: offscr, rgba 8/8/8/0, opaque, accum-rgba 16/16/16/16, dp/st/ms: 24/8/0, dbl, mono  , hw, GLProfile[GL2/GL2], pbuffer [r2t 0, r2tr 0, float 0]]

What I need to get are the extension list. That list is availiable later in the code in the "init()" method of a GlCanvas, hence after it has been made visible by a frame of some kind. the code line is this:

JoglVersion.getGLInfo(gl, null).toString();

The problem is that it needs a GL object, and the associated context. If I try to access that info before the windows made visible I'm back into the NPE which are the scope of this thread.