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++)
{
glPushMatrix();
glTranslatef(i,0.0f,1.0f);
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);
glEnd();
glPopMatrix();
}

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

glRotatef(45*i,1.0f,0.0f,0.0f);

instead
glTranslatef(i,0.0f,1.0f);
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.