Login  Register

Re: unusable profile selected with GL2ES2 capabilities - a bug or a ..feature?

Posted by Sven Gothel on Aug 31, 2013; 4:57am
URL: https://forum.jogamp.org/unusable-profile-selected-with-GL2ES2-capabilities-a-bug-or-a-feature-tp4029916p4029934.html

On 08/30/2013 06:49 PM, Xerxes Rånby [via jogamp] wrote:

>     eimaiosatanas wrote
>     GL_VENDOR: ATI Technologies Inc.
>     GL_RENDERER: AMD Radeon HD 7700 Series
>     GL_VERSION: 4.2.12217 Core Profile Context 12.104
>     Error compiling the vertex shader: Vertex shader failed to compile with
>     the following errors:
>     ERROR: error(#272) Implicit version number 110 not supported by GL3
>     forward compatible context
>     ERROR: error(#273) 1 compilation errors.  No code generated
>
> This particular error can only be avoided by adding a version line
> #version 130
> // GLSL 1.3 is the lowest version of GLSL supported by OpenGL 3.3 GLSL spec
> at the top of the vertex and fragment shader when using a GL3 or GL4 context.
> It looks like AMD GPU drivers enforce the opengl spec that require the version
> to be explicitly set.
>

.. allow me to advertise our default shader customizations:
 
<http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareES2.java;h=1ba4d126fd3789a735a316c28b959b18a28e1094;hb=HEAD#l80>

  final ShaderCode vp0 = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, this.getClass(), "shader",
          "shader/bin", "RedSquareShader", true);
  final ShaderCode fp0 = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, this.getClass(), "shader",
          "shader/bin", "RedSquareShader", true);
  vp0.defaultShaderCustomization(gl, true, true);
  fp0.defaultShaderCustomization(gl, true, true);
  final ShaderProgram sp0 = new ShaderProgram();
  sp0.add(gl, vp0, System.err);
  sp0.add(gl, fp0, System.err);

Note: You can check our other demos which all 'edit' the shader code
in runtime to match the running GL context.
Some even inject specific texture lookup functions etc (GLMediaPlayer, ..)
using the ShaderCode class.

+++

'defaultShaderCustomization(..)' of class ShaderCode
adds the accurate GLSL version and the default precision
is so requested.

The GLSL version is queried via: GLContext's getGLSLVersionString()'.

+++

Further more .. GLContext provides a method 'isGLcore()',
which allows you to query whether this context is core only
and may be restricted by VBO only usage .. etc.

  /**
   * Indicates whether this GLContext uses a GL core profile. <p>Includes [ GL4, GL3, GLES3, GL2ES2 ].</p>
   */
  public final boolean isGLcore() {
      return ( 0 != ( ctxOptions & CTX_PROFILE_ES ) && ctxVersion.getMajor() >= 2 ) ||
             ( 0 != ( ctxOptions & CTX_IS_ARB_CREATED ) &&
               0 != ( ctxOptions & CTX_PROFILE_CORE ) &&
               ctxVersion.compareTo(Version310) >= 0
             ) ;
  }


~Sven


signature.asc (911 bytes) Download Attachment