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

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -