PDA

View Full Version : Which is the best way to dray a cuboid?



Qiaowen
04-11-2012, 06:23 AM
Hello.
I want to draw a cuboid,and I want the length, width, height and color can be assigned. Do I have to use this kind of codes:
glBegin( GL_QUADS );
glVertex3f();
glEnd();
Is there any better way? And I also want to assign color value.

V-man
04-11-2012, 10:08 AM
Hello.
I want to draw a cuboid,and I want the length, width, height and color can be assigned. Do I have to use this kind of codes:
glBegin( GL_QUADS );
glVertex3f();
glEnd();
Is there any better way? And I also want to assign color value.

It depends on what GL version you are targeting.
The code you showed is GL 1.1.
In GL 1.1, you can also use vertex arrays.
http://www.opengl.org/wiki/Vertex_Arrays

Starting from GL 1.5 up to GL 4.1, you can use VBO
http://www.opengl.org/wiki/Vertex_Buffer_Object