I would like to attach a geometry shader to my existing (and working) vertex and fragment shaders. The snippet responsible for building the program:
int geometryShader = GLES31.glCreateShader(GLES31Ext.GL_GEOMETRY_SHADER_EXT);
glShaderSource(geometryShader, geometryShaderSource);
glCompileShader(geometryShader);
// Error checking:
glGetShaderiv(geometryShader, GL_COMPILE_STATUS, success, 0);
if(success[0] == 0)
Log.v(Debug.shaderHelper, "Geometry Shader Compile Failed: " + glGetShaderInfoLog(geometryShader));
int program = glCreateProgram();
glAttachShader(program, vertexShader);
glAttachShader(program, geometryShader);
glAttachShader(program, fragmentShader);
glLinkProgram(program);
And here is the geometry shader:
#version 310 es
layout (triangles) in;
layout (triangle_strip) out;
layout (max_vertices = 3) out;
void main(void){
int i
for (i = 0; i < gl_in.length(); i++){
//gl_Position = gl_in[i].gl_Position;
gl_Position = vec4(0.0);
//EmitVertex();
}
//EndPrimitive();
}
This shader should be just a pass-through shader (just for testing for now). The problem is that the geometry shader code has no effect on the final processing of the vertices. Even though I commented out important parts of the code, it still works. (Not to mention the missing semicolon.)
There are no errors logged, even though I check them.
So my questions are:
How can I compile a geometry shader on android?
Why are there no errors?
Can I just attach the geometry shader to the program just like the vertex and fragment shader?