Jump to content
  • Advertisement
Sign in to follow this  

Can't get integer vertex attributes to work with shader/vbo

This topic is 2220 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am able to get vec2, vec3, vec4 and float attributes to work, but I can't seem to get an integer vertex attribute to work.
Here's the process I'm using:

Data creation:

GLuint * int_array = new GLuint[lPolygonVertexCount];
for (int i=0; i < lPolygonVertexCount; i++)


VBO creation:

glGenBuffers(VBO_COUNT, mVBONames);

glBindBuffer(GL_ARRAY_BUFFER, mVBONames[INT_VBO]);
glBufferData(GL_ARRAY_BUFFER, lPolygonVertexCount*sizeof(GLuint), int_array,GL_STATIC_DRAW);
delete[] int_array;

Before drawing:

GLint my_int_id = glGetAttribLocation(shader_program,"my_int");
glBindBuffer(GL_ARRAY_BUFFER, mVBONames[INT_VBO]);
glVertexAttribPointer(my_int_id,1, GL_UNSIGNED_INT, GL_FALSE, 0, 0);


attribute uint my_int;
void main()

The value of my_int always ends up being 0 and not 2. If I change all the relavent types to float, the attribute works just fine.
Any ideas for what the problem could be?

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!