...because the floats seem to be coming out fine, but there\'s something wrong with the ints.
Essentially I have a struct called \"BlockInstance\" which holds a
layout (location = 4) in int TexIndex;
There's your problem.
glVertexAttribPointer is used to send data that will be converted to floating-point values. It's used to feed floating-point attributes. Passing integers is possible, but those integers are converted to floats, because that's what glVertexAttribPointer
is for.
What you need is glVertexAttribIPointer
(notice the I). This is used for providing signed and unsigned integer data.
So if you declare a vertex shader input as a float
or some non-prefixed vec
, you use glVertexAttribPointer
to feed it. If you declare the input as int
, uint
, ivec
or uvec
, then you use glVertexAttribIPointer
.