Hi, im trying to make a DisplayList in Opengl (glut)
This is the box (WallPiece) , that is calling to the _displayListId
Code:
void build(){
glMatrixMode(GL_MODELVIEW);
glColor3f(1.0f, 1.0f, 1.0f);
glEnable(GL_TEXTURE_2D);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glLoadIdentity();
glBegin(GL_QUADS);
glTexCoord2f(0.0f, 1.0f);
glVertex2f(0, 0);
glTexCoord2f(0.0f, 0.0f);
glVertex2f(0.1, 0);
glTexCoord2f(1.0f, 0.0f);
glVertex2f(0.1, 0.1);
glTexCoord2f(1.0f, 1.0f);
glVertex2f(0, 0.1);
glEnd();
glDisable(GL_TEXTURE_2D);
}
This is inside the initRendering()
Code:
_displayListId = glGenLists(1);
glNewList(_displayListId, GL_COMPILE);
build();
glEndList();
And this should display it
Code:
void drawScene() {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glBindTexture(GL_TEXTURE_2D, _wall2);
for(xloop = -1; xloop<3; xloop++){
glTranslatef(xloop, yloop, -3);
glCallList(_displayListId);
}
glPopMatrix();
glutSwapBuffers();
}
I want it to be a long wall, my code kinda works, i get many of my WallPiece in a row, but all of them are in different scales, brobably on the Z-axis.
Can anyone tell me what i have missed, or whats wrong?
//ty in advace