Login  Register

Re: What profile to choose?

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

On Saturday, December 10, 2011 06:05:01 PM Jeffg [via jogamp] wrote:
>
> Thanks for the info - I've read through the links you posted.  Here is some
> of my confusion - I use shaders, so I know I utilize the programmable
> pipeline, but I'm less clear on what calls represent a fixed pipeline call.
> For example, let's say I create a display list that creates a quad, no
> shader called, is that using the fixed pipeline?

Display lists are deprecated in core profiles for OpenGL 3 and 4,
hence GL3 and GL4 doesn't have them in (but GL3bc and GL4bc).

>
> Also, I guess I'm having trouble understanding if compatibility is for the
> API or OpenGL itself.  For example, does using GL3 or GL4 make you're
> application incompatible with someone running OpenGL 2.1.  If so, does using
> GL4bc change that, or does it just allow your API to use commands that are
> part of the fixed pipeline (again, which I don't quite get).  Why would you
> use GL3bc over GL4bc, if GL4bc is backward compatible?  I think I understand
> the mobile vs desktop, as the mobile profile would probably prevent you from
> calling things that are not available on mobile devices.  Is that the same
> with GL2 vs GL3.. GL2 just prevents you from making calls to commands only
> available on OpenGL 3.1?  If you used GL3, but didn't make calls above a GL2
> level, would you gain anything by using a higher GL level.. so if the user
> had installed OpenGL 3.1, would using GL3 with GL2 calls improve performance
> or anything?

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);
   ...

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.

>
> 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