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

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -