Login  Register

Re: What profile to choose?

Posted by Sven Gothel on Dec 10, 2011; 8:46pm
URL: https://forum.jogamp.org/What-profile-to-choose-tp3575514p3576066.html

On Saturday, December 10, 2011 09:40:02 PM Sven Gothel wrote:

>
> First of all, GLBase, GL, GL2ES2, GL2GL3, GL2, GL3, GLES2, .. are all interfaces.
> The only implementations are: GL4bcImpl for desktop and GLES1Impl/GLES2Impl for mobile.
>
> Since the interfaces all derive from each other according to the GL profile spec,
> you can safely cast your instance to any compatible profile's interface:
>
>   GL gl;
>   if(gl.isGL3()) {
>     GL3 gl3 = gl.getGL3();
>     // do GL3 specifics ..
>   }
>
>
> Ususally you don't do this:
>
> (E1)
>    GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL3));
>    GLWindow glWindow = GLWindow.create(caps);
>    ...
>
> but this:
>
> (E2)
>
>    GLCapabilities caps = new GLCapabilities(GLProfile.getGL2ES2());
>    GLWindow glWindow = GLWindow.create(caps);
>    ...
>
> or this:
>
> (E3)
>
>    GLCapabilities caps = new GLCapabilities(GLProfile.getDefault());
>    GLWindow glWindow = GLWindow.create(caps);
>    ...

(E4/E5)
    GLCapabilities caps = new GLCapabilities(GLProfile.getMaxProgrammable());
    GLWindow glWindow = GLWindow.create(caps);
    ...

    GLCapabilities caps = new GLCapabilities(GLProfile.getMaxFixedFunc());
    GLWindow glWindow = GLWindow.create(caps);
    ...

>
> Both, E2 and E3 will result with the highest GL context possible compatible
> with the requested one - here the 1st available:
>    GL2ES2: GL4bc, GL4, GL3bc, GL3, GL2 or ES2
>    default: GL4bc, GL3bc, GL2, GL4, GL3, GL2GL3, GLES2, GL2ES2, GLES1, GL2ES1
>
>    http://jogamp.org/git/?p=jogl.git;a=blob;f=src/jogl/classes/javax/media/opengl/GLProfile.java;hb=HEAD#l1580
>
> E1 is not desired, since you don't know what is available on your clients platform
> so you might want to query it (see last post and Siggraph 2010 presentation p9 or so ..).
>
> With E2 and E3 you are most flexible. Sure - if you require some sort of features
> and they are not available you can query that upfront and make a 'nice' exit.

E4/E5 limit the use on a specific 'branch' of GL profile,
ie programmable or fixed-function.

In regards to fixed function pipeline, I would always avoid immediate mode
and display lists, since they are not even supported on mobile devices ES1 profile.
If you properly use VBOs instead of the above, your fixed function code would most likely
work on GL2ES1 and hence ES1 mobile devices.
Ofc .. today the most desired way to impl. 3D is programmable pipeline due to todays hw GPU design.

>
> >
> > Sorry for all the questions - I appreciate the assistance.
>
> Hope this helps a bit.
>
> Maybe some additional browsing / reading of the actual GL specs may help, eg:
>
> http://www.opengl.org/registry/doc/glspec42.core.20110808.pdf
>   - Appendix E, specifically E.2
>
> Of course, you can also check the different GL interfaces
> which clearly show whats available in the common subsets (GL2GLES1, GL2ES2, GL2GL3)
> and their 'final' interfaces (GL2, GL3, .., GLES2).
>
> ~Sven
>
>
> > - Jeff
>