c++ - Allocating vertex buffer object -
i'm trying create terrain heightmap in opengl(c++), , following this tutorial.
i'm trying use vertex buffer object speed up. in example, create vertex object 3 floats x, y, z. pass pointer array of these vertex objects copied buffer object. don't understand why size of buffer parameter pass size of 3 floats (multiplied number of vertices).
surely vertex objects being passed larger size of 3 floats? glbufferdataarb function somehow extract these variables? size of object equal size of variables in it? or missing something?
vbos store bytes. later gl*pointer()
and/or glvertexattrib()
calls tell opengl how interpret bytes.
to store 3 floats need sizeof(float) * 3
bytes.
to store n
three-float vertices need sizeof(float) * 3 * n
bytes.
Comments
Post a Comment