opengl - What does the last parameter of glVertexAttribPointer mean? -
i began learning opengl, don't understand last parameter in glvertexattribpointer
means.
it's pointer offset array you're using. however, it's byte count have cast pointer, isn't intuitive.
if you're using interleaved attributes, it's number of bytes beginning first instance of attribute.
example:
vvvnnnttvvvnntt
where vertex position data, n normal vector, , t texture corodinate.
the offset v 0
(it's @ beginning)
the offset n (glvoid*) (3*sizeof(vertex data type))
the offset t (glvoid*) (3*sizeof(vertex data type) + 3*sizeof(normal data type) )
furthermore, if have successive attributes, starting point each attribute well.
example:
vvvv...vvvnnn...nnntt...tt
the offset v 0
(it's @ beginning)
the offset n (glvoid*) (3*sizeof(vertex data type)*number_of_vertices)
the offset t (glvoid*) (3*sizeof(vertex data type)*number_of_vertices + 3*sizeof(normal data type)*number_of_normals)
Comments
Post a Comment