Greetings,
after reading several OpenGL documentations I understand that glVertexAttribPointer takes a numeral value between 1 and 4 for its second parameter (size) as information how many vertices are taken into consideration to render a single triangle. But I do not understand how to use other then three vertices for a triangle. Also trying different values and seeing the result doesn't help me.
What exactly does this do and what is it used for?
Cheers,
Jan
glVertexAttribPointer - understanding the size attribute
It's the number of components that make up the attribute (e.g. x, y and z is 3 components).
e.g. if size is 3, and type is [font=courier new,courier,monospace]GL_FLOAT[/font], then the corresponding C/C++ type is [font=courier new,courier,monospace]float[3][/font] and the GLSL type is [font=courier new,courier,monospace]vec3[/font].
e.g. if size is 3, and type is [font=courier new,courier,monospace]GL_FLOAT[/font], then the corresponding C/C++ type is [font=courier new,courier,monospace]float[3][/font] and the GLSL type is [font=courier new,courier,monospace]vec3[/font].
For example, you might have an attribute with 2 as size for texture coords, or a size of 4 if you need x,y,z,w coords (which you will eventually). Moreover, it doesn't needs to be juts coordinates, you could store color in with 4 components in RGBA form (red, green, blue, alpha).
You can additional information besides the position of a vertex.
You can additional information besides the position of a vertex.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement