View Full Version : VertexAttribIPointer and Vertex Shader

04-27-2010, 02:42 AM

I'm having trouble with some transform feedback algorithm.
here's my (ultra) simplified code :

// main.cpp
glVertexAttribIPointer(0, 2, GL_INT, 0, BUFFER_OFFSET(0));

// set the transform feedback mode
glDrawArrays(GL_POINTS, 0, count);
// end the transform feedback

// Vertex Shader
in ivec2 culled;

flat out int id;
flat out int keep;

void main(void)
id = culled.x;

keep = 0;
if(culled.y == 1) keep = 1;
// Geometry Shader
layout(points) in;
layout(points, max_vertices = 1) out;

flat in int id[1];
flat in int keep[1];

flat out int listi;

void main()
if(keep[0] == 1)
listi = id[0];

When I check the data from the buffer, I get some crazy values such as : 0 1065353216 1073741824 1077936128 1082130432 1084227584 1086324736 1088421888 (used map/unmap).
I'm sure it has to do with the attribute pointer I'm setting because I know the data in the buffer I use for the draw call is valid (I used map/unmap to check aswell) and if I use hard coded values in the shader, everything goes fine.
Has anyone had trouble with the AttribIPointer before ?
Thanks for your help !

04-27-2010, 06:51 AM
I didn't have problems with AttribIPointer, used it successfully for hardware skinning with transform feedback.

Are you sure your setup works correctly in simple case:
-without geometry shader
-without input attributes

Post more code & your environment for farther investigation.

04-27-2010, 07:02 AM
Ok I've just change the AttribIpointer to an AttribPointer and changed my input ivec2 to vec2 in the vertex shader and everything's working.
This might be a driver issue. I'll update and post back the results...