GLProfile.isGL2Available() equivalent for current jogl code

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

GLProfile.isGL2Available() equivalent for current jogl code

jurchiks
I'm updating the jogl libraries for a project that was last updated in 2011 (https://code.google.com/p/g3d-editor/). Obviously, the APIs have changed, but most of the updates for this project only required me to add "gl" as a parameter to some methods that were called.
The last thing that still gives me errors is this code:

        System.out.println("GL2:   " + (GLProfile.isGL2Available() ? "Yes" : "No"));
        System.out.println("GL3:   " + (GLProfile.isGL3Available() ? "Yes" : "No"));
        System.out.println("GL3bc: " + (GLProfile.isGL3bcAvailable() ? "Yes" : "No"));
        System.out.println("GL4:   " + (GLProfile.isGL4Available() ? "Yes" : "No"));
        System.out.println("GL4bc: " + (GLProfile.isGL4bcAvailable() ? "Yes" : "No"));

the GLProfile methods aren't available anymore, so I'm not sure what to use instead.
I found that there is GLProfile.isAvailable(String profile), should I use that?
Reply | Threaded
Open this post in threaded view
|

Re: GLProfile.isGL2Available() equivalent for current jogl code

Sven Gothel
Administrator
On 10/22/2014 09:36 PM, jurchiks [via jogamp] wrote:

> I'm updating the jogl libraries for a project that was last updated in 2011
> (https://code.google.com/p/g3d-editor/). Obviously, the APIs have changed, but
> most of the updates for this project only required me to add "gl" as a
> parameter to some methods that were called.
> The last thing that still gives me errors is this code:
>
>         System.out.println("GL2:   " + (GLProfile.isGL2Available() ? "Yes" :
> "No"));
>         System.out.println("GL3:   " + (GLProfile.isGL3Available() ? "Yes" :
> "No"));
>         System.out.println("GL3bc: " + (GLProfile.isGL3bcAvailable() ? "Yes" :
> "No"));
>         System.out.println("GL4:   " + (GLProfile.isGL4Available() ? "Yes" :
> "No"));
>         System.out.println("GL4bc: " + (GLProfile.isGL4bcAvailable() ? "Yes" :
> "No"));
>
> the GLProfile methods aren't available anymore, so I'm not sure what to use
> instead.
> I found that there is GLProfile.isAvailable(String profile), should I use that?
yes, i.e. w/ GLProfile.GL2 as an argument.

~Sven


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

Re: GLProfile.isGL2Available() equivalent for current jogl code

gouessej
Administrator
This post was updated on .
In reply to this post by jurchiks
Sven is right:

System.out.println("GL2:   " + (GLProfile.isAvailable(GLProfile.GL2) ? "Yes" : "No"));
System.out.println("GL3:   " + (GLProfile.isAvailable(GLProfile.GL3) ? "Yes" : "No"));
System.out.println("GL3bc: " + (GLProfile.isAvailable(GLProfile.GL3bc) ? "Yes" : "No"));
System.out.println("GL4:   " + (GLProfile.isAvailable(GLProfile.GL4) ? "Yes" : "No"));
System.out.println("GL4bc: " + (GLProfile.isAvailable(GLProfile.GL4bc) ? "Yes" : "No"));

http://jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/javax/media/opengl/GLProfile.html#isAvailable(java.lang.String)

Edit.: You could have used "final GL gl = GLContext.getCurrentGL();" instead of passing GL instances. GLShader and GLUniform could probably be replaced by some JOGL classes (GLUniformData, ShaderCode, ShaderProgram, ShaderState, ShaderUtil). Using display lists isn't a good idea, the speed up isn't consistent across platforms and it is badly implemented in some drivers.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: GLProfile.isGL2Available() equivalent for current jogl code

jurchiks
This post was updated on .
@Sven - thanks for the parameter tip, didn't know about the constants, I just hardcoded them.

@gouessej - all that is in the future and if I ever get around to learning that stuff. I've never done anything graphical, so it's going to take a while.
The GL parameter is being passed all around the code. I didn't make it that way, I only made minor fixes and alterations to it to keep it up to date.