I have a quite strange issue. Please, look at these screenshots:




Code of that object:
void prostopadloscian(float x, float y, float z, float red, float green, float blue)
{
glBegin(GL_QUADS);
glColor3f(red, green, blue);
glNormal3f(-x,-y,-z);
glVertex3f(-x,-y,-z);
glNormal3f(x,-y,-z);
glVertex3f(x,-y,-z);
glNormal3f(x,-y,z);
glVertex3f(x,-y,z);
glNormal3f(-x,-y,z);
glVertex3f(-x,-y,z);
glNormal3f(-x,y,-z);
glVertex3f(-x,y,-z);
glNormal3f(x,y,-z);
glVertex3f(x,y,-z);
glNormal3f(x,y,z);
glVertex3f(x,y,z);
glNormal3f(-x,y,z);
glVertex3f(-x,y,z);
glNormal3f(-x,y,z);
glVertex3f(-x,y,z);
glNormal3f(-x,-y,z);
glVertex3f(-x,-y,z);
glNormal3f(-x,-y,-z);
glVertex3f(-x,-y,-z);
glNormal3f(-x,y,-z);
glVertex3f(-x,y,-z);
glNormal3f(-x,-y,-z);
glVertex3f(-x,-y,-z);
glNormal3f(x,-y,-z);
glVertex3f(x,-y,-z);
glNormal3f(x,y,-z);
glVertex3f(x,y,-z);
glNormal3f(-x,y,-z);
glVertex3f(-x,y,-z);
glNormal3f(x,y,z);
glVertex3f(x,y,z);
glNormal3f(x,-y,z);
glVertex3f(x,-y,z);
glNormal3f(x,-y,-z);
glVertex3f(x,-y,-z);
glNormal3f(x,y,-z);
glVertex3f(x,y,-z);
glNormal3f(-x,y,z);
glVertex3f(-x,y,z);
glNormal3f(-x,-y,z);
glVertex3f(-x,-y,z);
glNormal3f(-x,-y,-z);
glVertex3f(-x,-y,-z);
glNormal3f(-x,y,-z);
glVertex3f(-x,y,-z);
glEnd();
}
void bed()
{
glPushMatrix();
glTranslatef(-1.6, 0, 4.6);
prostopadloscian(0.2, 0.25, 0.2, 0.35, 0.16, 0.14);
glPopMatrix();
glPushMatrix();
glTranslatef(1.6, 0, 4.6);
prostopadloscian(0.2, 0.25, 0.2, 0.35, 0.16, 0.14);
glPopMatrix();
glPushMatrix();
glTranslatef(-1.6, 0, -4.6);
prostopadloscian(0.2, 0.25, 0.2, 0.35, 0.16, 0.14);
glPopMatrix();
glPushMatrix();
glTranslatef(1.6, 0, -4.6);
prostopadloscian(0.2, 0.25, 0.2, 0.35, 0.16, 0.14);
glPopMatrix();
glPushMatrix();
glTranslatef(0.0, 0.55, 0.0);
prostopadloscian(2,0.3,5,0.85,0.85,0.95);
glPopMatrix();
}
my display() function starts at
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glClearColor(1.0, 1.0, 1.0, 1.0);
glEnable(GL_DEPTH_TEST);
glDisable(GL_TEXTURE_2D);
glLoadIdentity();
How to get rid of this ugly effect?
Yeah, those prostopadloscians do look a bit strange. It’s hard to say for sure from these shots, but some things to look at:
glNormalcall.)