Can't get GL2 from GL2GL3 on Mac OSX

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Can't get GL2 from GL2GL3 on Mac OSX

orenbum
I'm getting a "Not a GL2 implementation" exception when I try to get a GL2 object after requesting a GL2GL3 profile on Mac OSX with the latest version of jogl (2.1.5-01 from maven). On other platforms the code below executes without any errors:
    public static void main(String[] args) throws Exception {

        GLProfile profile = GLProfile.get(GLProfile.GL2GL3);
        
        GLDrawableFactory drawableFactory = GLDrawableFactory.getFactory( profile );
        GLCapabilities caps = new GLCapabilities( profile );
        GLOffscreenAutoDrawable offscreenDrawable = drawableFactory.createOffscreenAutoDrawable( null, caps, null, 1, 1 );
        offscreenDrawable.display( );
        GLContext context = offscreenDrawable.getContext();
        
        GL gl = context.getGL();
        GL2 gl2 = gl.getGL2();
    }

But on my macbook I get the following:
Exception in thread "main" javax.media.opengl.GLException: Not a GL2 implementation
	at jogamp.opengl.gl4.GL4bcImpl.getGL2(GL4bcImpl.java:37087)
	at com.oren.GL2Test.main(GL2Test.java:26)

So should we be able to get a GL2 object back there?

I'm running the latest version of OSX (10.9.2) and I believe my graphics drivers are up to date. I attached a dump of the context.toString() since that seemed to contain a bunch more information: context.txt
Reply | Threaded
Open this post in threaded view
|

Re: Can't get GL2 from GL2GL3 on Mac OSX

Sven Gothel
Administrator
On 04/09/2014 04:26 PM, orenbum [via jogamp] wrote:

> I'm getting a "Not a GL2 implementation" exception when I try to get a GL2
> object after requesting a GL2GL3 profile on Mac OSX with the latest version of
> jogl (2.1.5-01 from maven). On other platforms the code below executes without
> any errors:
>
>     public static void main(String[] args) throws Exception {
>
>         GLProfile profile = GLProfile.get(GLProfile.GL2GL3);
>        
>         GLDrawableFactory drawableFactory = GLDrawableFactory.getFactory( profile );
>         GLCapabilities caps = new GLCapabilities( profile );
>         GLOffscreenAutoDrawable offscreenDrawable = drawableFactory.createOffscreenAutoDrawable( null, caps, null, 1, 1 );
>         offscreenDrawable.display( );
>         GLContext context = offscreenDrawable.getContext();
>        
>         GL gl = context.getGL();
>         GL2 gl2 = gl.getGL2();
>     }
>
>
> But on my macbook I get the following:
>
> Exception in thread "main" javax.media.opengl.GLException: Not a GL2 implementation
> at jogamp.opengl.gl4.GL4bcImpl.getGL2(GL4bcImpl.java:37087)
> at com.oren.GL2Test.main(GL2Test.java:26)
>
>
> So should we be able to get a GL2 object back there?
Nope .. the highest available, which is a core profile on OSX
since the latter doesn't support FFP (fixed function pipeline) for GL >= 3.0.

Pls check the GLProfile.getMaxFixed...() methods how to get the highest
available FFP profile.

~Sven


signature.asc (894 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Can't get GL2 from GL2GL3 on Mac OSX

gouessej
Administrator
In reply to this post by orenbum
I agree with Sven. When you query a GL2GL3 implementation, you have to keep in mind that you query an implementation supporting the common subset of GL2 and GL3, not the whole GL2. Unfortunately, you have to choose between OpenGL 2.1 or OpenGL 3 core under recent Mac OS X versions whereas you can get a backward compatible profile supporting OpenGL 2 and OpenGL 3 features under GNU Linux and Windows. I would call getMaxFixedFunc if I were you except if you really need some OpenGL 3 methods.
Julien Gouesse | Personal blog | Website