I have been debugging this for a while but I can't seem to find the issue.

I created a framebuffer for layered rendering like this

GLuint buffer;


GLenum blub[] = {GL_COLOR_ATTACHMENT0};


where textures[0] is a 3D texture for layered rendering. The texture is texture complete, using nearest for min and mag filtering, no mip mapping, clamp to edge for s,t and r. I can sample from it fine (I initialize the texture to a color based on the z coordinate inside the 3d texture, it's initialized fine as well). The size of the 3D texture right now is 32x32x32 texels.

The framebuffer is framebuffer complete (checked it using glCheckFramebufferStatus).

Then I create and fill a buffer with vertex data for the points like this:

vector<vec2> points; 
points.push_back(vec2(0.0f,0.0f)); //should draw in the middle
points.push_back(vec2(0.5f,0.5f)); //3/4th in each direction
points.push_back(vec2(-0.5f,-0.5f)); //opposite of second point
points.push_back(vec2(-0.95f,-0.95f)); //first texel on the bottom left



where vec2 is the vec2 floating point vector class provided by GLM.

Then I render it by doing this:


where shader is a shader constructed from vertex, geometry and fragment shaders. It compiles fine without warnings. Depth and stencil testing are disabled. textureSizeX and textureSizeY are the width and height of the 3D texture.

Vertex shader:

#version 430

layout(location =0) in vec2 pos;

void main()
    gl_Position = vec4(pos.xy,0,1);

Geometry shader:

#version 430

layout(points) in;
layout(points, max_vertices = 1) out;

void main()
    gl_Layer = 0;
    gl_Position = vec4(gl_in[0].gl_Position.xy,1,1);
    gl_PointSize = 1.0f;


Fragment shader:

#version 430

out vec4 outcolor;

void main()
    outcolor = vec4(0,1,0,0);

However, only the first point is drawn, as expected in the middle of layer 0 of the 3D texture. I can move around the coordinates of the first point and get the expected results. The points after the first point are always ignored, however. What am I doing wrong?

Hardware is GTX 770 with driver version 331.82 (latest version). Tested it on GT 555M (Notebook GPU), same results. The OpenGL device context is version 4.3.

edit: Tried so far: When I extend the attribute input of the vertex data to a vec4, and change the argument in glVertexAttribPointer accordingly, as expected the z and w components of the vec4 contain the coordinates of the second point, so the positions seem to be in memory as expected.

Similarly, if I change the offset using glVertexAttribPointer (e.g. putting (void*)(sizeof(vec2)*3) as the last parameter), the respective point is drawn.

Just to test if something may be wrong with the rasterization in general, I tried emitting triangles instead of points in the geometry shader. This works as expected.

  • \$\begingroup\$ Question:Are layout(location=5) + the two glEnableVertexAttribArray(5) and glVertexAttribPointer(5,...) correct OpenGL? No errors are detected via glGetError(), but changing everything from 5 to 0 makes it work. \$\endgroup\$
    – TravisG
    Nov 24, 2013 at 19:58

1 Answer 1


I've since solved it, and since I tried all possible permutations of changes I could think off, I think it might simply be a driver bug.

I just changed the attribute location back to 0 in the shader and changed the respective arguments in the C++ side function calls as well. Afaik 5 should work just as well, but for some reason it doesn't.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .