Loop in Open GL

How looping in OpenGl in oder to fill space from example?
glutWireCube (1.0);
glTranslatef (1.0,0.0,0.0);
glutWireCube (1.0);
glTranslatef (0.0,-1.0,0.0);
glutWireCube (1.0);

I am interesting instead fill space make loop or matrix with object which i gave example .

Fill what space?
You can’t loop in GL, you can only call GL functions.

Do you mean make the object appear solid without any holes?

It appears as it does because you asked glut to draw a wrireframe cube.
Try glutSolidCube instead.

I want copy square in loop ( for ) , where i take mistake ?

for (int i=0;i<3 ;i++)
glBegin (GL_POLYGON);
glVertex3f (0.0,0.0,0.0);
glVertex3f (0.0,0.5,0.0);
glVertex3f (0.5,0.5,0.0);
glVertex3f (0.5,0.0,0.0);

Well what’s going wrong? Is it crashing? Are aliens invading? Did somebody decide to remake Dynasty on account of it? Is it drawing something else? Or is it just not drawing at all?

If i make


that square moves in the pit
If i make glTranslatef(i,0.0f,1.0f);
that square stands in the place .
what i am badly defined ? glTranslatef ought move that square .

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.