PDA

View Full Version : VBO for geometric primitive



OGNewBee
05-31-2011, 03:08 AM
Hi,

I need to have the VBO for static geometric primitives.
Like I want to populate/have VBO to hold one line, square, circle and polygon each with different colors.
Is it possible to hold all above specified geometric objects under one VBO?

Code snippet (few important lines will do) would be very very helpful.

Thanks.

V-man
05-31-2011, 05:29 AM
Did you look at the Wiki?
http://www.opengl.org/wiki/Vertex_Arrays

just make a struct with your color attribute



struct MyVertex
{
float x, y, z;
float nx, ny, nz;
uint color; //RGBA
//whatever else you want
}


and shove all your vertices in a VBO.
Set it up with glColorPointer...

http://www.opengl.org/wiki/Vertex_Buffer_Object
http://www.opengl.org/wiki/Vertex_Formats
http://www.opengl.org/wiki/VBO_-_more
http://www.opengl.org/wiki/General_OpenGL