Fast identification of available opengl version

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

Fast identification of available opengl version

karelknoes
Hi, I'm looking for a fast check to determine which maximum openGL version is available before anything else happens.

The current solution I'm using is to create a PBuffer and get the available opengl from it. It takes about a second to complete on a fast machine, which seems rather steep to determine a hardware specification.

Looking forward to your thoughts on such a check.

Reply | Threaded
Open this post in threaded view
|

Re: Fast identification of available opengl version

Sven Gothel
Administrator
On 02/07/2012 04:21 PM, karelknoes [via jogamp] wrote:

>
>
> Hi, I'm looking for a fast check to determine which maximum openGL version is
> available before anything else happens.
>
> The current solution I'm using is to create a PBuffer and get the available
> opengl from it. It takes about a second to complete on a fast machine, which
> seems rather steep to determine a hardware specification.
>
> Looking forward to your thoughts on such a check.
>
http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile01NEWT.java;hb=HEAD#l103

check the static profile function in GLProfile .. I guess you will find something useful there.

~Sven


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

Re: Fast identification of available opengl version

karelknoes
Thanks very much for the fast reply! The static profile functions seem to be excellent for a coarse version check.

It does seem though that a more detailed check, e.g. minimally opengl version 1.5, is not available. Am I overlooking something?
Reply | Threaded
Open this post in threaded view
|

Re: Fast identification of available opengl version

gouessej
Administrator
Hi

Use gl.glGetString(GL.GL_VERSION) to get the exact supported version.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Fast identification of available opengl version

Sven Gothel
Administrator
In reply to this post by karelknoes
On 02/07/2012 04:51 PM, karelknoes [via jogamp] wrote:
>
>
> Thanks very much for the fast reply! The static profile functions seem to be
> excellent for a coarse version check.
>
> It does seem though that a more detailed check, e.g. minimally opengl
> version 1.5, is not available. Am I overlooking something?
>

According to our GL profile mapping
  <http://jogamp.org/jogl/doc/bouml/html-svg/fig128069.svg>

we only pick the highest available for each profile.

The other generic GLProfile selections (MaxProgrammable, Default, ..)
are cross profiles (eg. MaxProgrammable returns GL4 if [GL2, GLES2, GL3, GL4] is avail.

Picking a lower OpenGL version number IMHO makes no sense.

~Sven


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

Re: Fast identification of available opengl version

karelknoes
gouessej. I'm currently indeed using gl.glGetString(GL.GL_VERSION). The downside of this approach seems to be that I first need to create the glContext, which takes about a second.

Sven, let's say that only GL2 is available. Would I be able to tell from this profile which specific (sub)version is available? Namely, we require at least version 1.5.
Reply | Threaded
Open this post in threaded view
|

Re: Fast identification of available opengl version

Sven Gothel
Administrator
On 02/07/2012 05:17 PM, karelknoes [via jogamp] wrote:
>
>
> gouessej. I'm currently indeed using gl.glGetString(GL.GL_VERSION). The
> downside of this approach seems to be that I first need to create the
> glContext, which takes about a second.
>
> Sven, let's say that only GL2 is available. Would I be able to tell from
> this profile which specific (sub)version is available? Namely, we require at
> least version 1.5.

Nope, not really.

The actual GLContext has some query methods:

  public final int getGLVersionMajor()
  public final int getGLVersionMinor()
  public final boolean isGLCompatibilityProfile()
  public final boolean isGLForwardCompatible()
  public final boolean isGLDebugEnabled()
  public final boolean isCreatedWithARBMethod()

You can also test availability of extensions via:

   [GLContext/GL] boolean isExtensionAvailable(String)

and functions (not so reliable):

   [GLContext/GL] boolean isFunctionAvailable(String)

~Sven



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

Re: Fast identification of available opengl version

karelknoes
All right, good to know that I don't need to look further. Thanks a lot of the help :).
Reply | Threaded
Open this post in threaded view
|

Re: Fast identification of available opengl version

gouessej
Administrator
You're welcome. There is no cross-platform way to know which minor version is supported before the creation of the context as far as I know. I understand your position, I still support OpenGL 1.2 in some programs (TUER alpha version).
Julien Gouesse | Personal blog | Website