Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to make many cubes orthogonal in opengl.
i made 1 cube like this ↓

C#
glBegin(GL_QUADS);        // Draw The Cube Using quads
   glColor3f(0.0f,1.0f,0.0f);    // Color Blue
   glVertex3f( 1.0f, 1.0f,-1.0f);    // Top Right Of The Quad (Top)
   glVertex3f(-1.0f, 1.0f,-1.0f);    // Top Left Of The Quad (Top)
   glVertex3f(-1.0f, 1.0f, 1.0f);    // Bottom Left Of The Quad (Top)
   glVertex3f( 1.0f, 1.0f, 1.0f);    // Bottom Right Of The Quad (Top)
   glColor3f(1.0f,0.5f,0.0f);    // Color Orange
   glVertex3f( 1.0f,-1.0f, 1.0f);    // Top Right Of The Quad (Bottom)
   glVertex3f(-1.0f,-1.0f, 1.0f);    // Top Left Of The Quad (Bottom)
   glVertex3f(-1.0f,-1.0f,-1.0f);    // Bottom Left Of The Quad (Bottom)
   glVertex3f( 1.0f,-1.0f,-1.0f);    // Bottom Right Of The Quad (Bottom)
   glColor3f(1.0f,0.0f,0.0f);    // Color Red
   glVertex3f( 1.0f, 1.0f, 1.0f);    // Top Right Of The Quad (Front)
   glVertex3f(-1.0f, 1.0f, 1.0f);    // Top Left Of The Quad (Front)
   glVertex3f(-1.0f,-1.0f, 1.0f);    // Bottom Left Of The Quad (Front)
   glVertex3f( 1.0f,-1.0f, 1.0f);    // Bottom Right Of The Quad (Front)
   glColor3f(1.0f,1.0f,0.0f);    // Color Yellow


I thought make "for", i can make cubes using array. But not works :(
How can I make many cubes ?
Posted
Updated 23-Mar-15 2:27am
v2
Comments
Sergey Alexandrovich Kryukov 23-Mar-15 8:46am    
Orthogonal to what? The question makes no sense?
And a cube (not side or a rib of the cube, but the cube itself) can be orthogonal to something only in 4D, when you go out of the cube's 3D space (isn't it obvious?). I believe OpenGL is not yet developed to so advanced level. :-)
—SA
songsarri 23-Mar-15 9:04am    
Thank U for answer !
Sorry, I mean i want put a new box besides (already put)boxes.
I want to make a space and stacking many boxes on there.
In this situation, can i make many boxes with "for"? ( not writes all the lines about coordinates.)
barneyman 23-Mar-15 9:23am    
generally in 3D gfx programming, you have one set of object world models, and you position/repeat them with world & view transforms
Sergey Alexandrovich Kryukov 23-Mar-15 9:28am    
For that matter, yes, "for" can be used. :-)
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900