Posted by
AlanObject on
Sep 18, 2014; 2:09pm
URL: https://forum.jogamp.org/RawGL2ES2demo-fails-on-the-Mac-tp4033162p4033164.html
This is the code from here:
http://jogamp.org/git/?p=jogl-demos.git;a=blob;f=src/demos/es2/RawGL2ES2demo.java;hb=HEADThe shader starts out like this (I left the line numbers in)
109 private String vertexShaderString =
110 // For GLSL 1 and 1.1 code i highly recomend to not include a
111 // GLSL ES language #version line, GLSL ES section 3.4
112 // Many GPU drivers refuse to compile the shader if #version is different from
113 // the drivers internal GLSL version.
114 //
115 // This demo use GLSL version 1.1 (the implicit version)
116
117 "#if __VERSION__ >= 130\n" + // GLSL 130+ uses in and out
118 " #define attribute in\n" + // instead of attribute and varying
119 " #define varying out\n" + // used by OpenGL 3 core and later.
120 "#endif\n" +
121
122 "#ifdef GL_ES \n" +
123 "precision mediump float; \n" + // Precision Qualifiers
124 "precision mediump int; \n" + // GLSL ES section 4.5.2
125 "#endif \n" +
126
127 "uniform mat4 uniform_Projection; \n" + // Incomming data used by
128 "attribute vec4 attribute_Position; \n" + // the vertex shader
129 "attribute vec4 attribute_Color; \n" + // uniform and attributes
130
131 "varying vec4 varying_Color; \n" + // Outgoing varying data
132 // sent to the fragment shader
133 "void main(void) \n" +
134 "{ \n" +
135 " varying_Color = attribute_Color; \n" +
136 " gl_Position = uniform_Projection * attribute_Position; \n" +
137 "} ";
138
Then before it is used there is this code in the init method
344 if(gl.isGL3core()){
345 System.out.println("GL3 core detected: explicit add #version 130 to shaders");
346 vertexShaderString = "#version 130\n"+vertexShaderString;
347 fragmentShaderString = "#version 130\n"+fragmentShaderString;
348 }
Since the Mac has a GL3 core the if statement resolves to true. Taking this logic out ends up in a different shader compiler failure which says a version is needed. I guess the question is which one?