Geometry Shader - Incorrect Output
Submitted by dan..@...co.uk
Assigned to Default DRI bug account
Description
Created attachment 129684 Typical output
Hi,
I am developing a cross-platform application. I have recently found an issue that is only present when it is tested on a Ubuntu machine. I have managed to find a minimal example that shows the issue as follows:
The vertex shader:
#version 150 in vec2 pos;
void main(void) { gl_Position = vec4(pos, 0.0, 1.0); }
The fragment shader:
#version 150 out vec4 outColour;
void main(void) { outColour = vec4(1.0f, 1.0f, 1.0f, 1.0f); }
The geometry shader:
#version 150 layout(points) in; layout(line_strip, max_vertices = 13) out; uniform mat4 vpMatrix;
void main() { for(int i = 0; i < 13; i++) { float polygonAngle = (i * 30) + 90.0f; vec4 vertexPosition = vec4((sin(radians(polygonAngle)) * 0.5f) + gl_in[0].gl_Position.x, (cos(radians(polygonAngle)) * 0.5f) + gl_in[0].gl_Position.y, 0.0f, 1.0f); gl_Position = vpMatrix * vertexPosition; EmitVertex(); } EndPrimitive(); }
The problem occurs when the shader program is used with multiple VBO's. For example:
3 separate VBO's are created with {-1.0f, 1.0f}, {1.0f, 1.0f}, {1.0f, -1.0f} as the data. Then, for each repaint:
for(int i = 0; i < 3; i++) { Bind array buffer i. glDrawArrays(GL_POINTS, 0, 1); }
This produces strange results for the third polygon (shown in the attached image Output.JPG).
If tested on a Windows 10 machine (exactly the same hardware) or an OSX machine, the results are as expected (3 regular polygons with 12 sides).