I keep getting a black, blue or white screen depending on the alterations I make to my code but the image does not upload. I think the problem is with the display function. I have functions in the display function but I don’t think that should matter. My display function looks something like this:
void display(void)
{
//clear the screen
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glRotatef(Angle, 0.0, 0.0, 0.0);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); // Select the texture to use glBindTexture(GL_TEXTURE_2D, texture[0]);
// Draw our texture
glEnable(GL_TEXTURE_2D);
//Nose
drawTriangle();
//Face
circle (250, 250, 400);//Inner Eyes
glLoadIdentity();
circle(200, 280, 10);
drawCircle1(-30, 280, 10);//Eye lids
glLoadIdentity();
glScalef(0.6,0.2,0);
circle(530, 2400, 60);
circle(-150, 2150, 60);//Arc for eyebrows
drawArc(500, 500, -70, -140, 100);
drawArc(270, 500, -70, -140, 100);//Mouth
drawArc(380, 250, 110, -180, 180);
// drawArc(380, 100, -100, -180, 180);
drawLine();glDisable(GL_TEXTURE_2D);
// ----- Stop Drawing Stuff! ------
glfwSwapBuffers(); // Swap the buffers to display the scene (so we don’t have to watch it being drawn!)
}
An example of the circle function is:
void circle(GLint x, GLint y, GLint radius)
{
float angle;glTranslatef(300, 100, 0.0);
glTranslatef(0.0,150.0, 1.0);
glColor3f(0.0f, 1.0f, 0.0f);
glBegin(GL_LINE_LOOP);
for (int i = 0; i < 100; i++)
{
angle = i2PI/100;
float X = x + (cos(angle) * radius);
float Y = y + (sin(angle) * radius);
glVertex2f(X, Y);
//glVertex2f(x + (cos(angle) * radius), y + (sin(angle) * radius));
}
glEnd();
}
And my main function looks like this:
int main (int argc, char** argv)
{
glutInit (&argc, argv);
// Initialize GLUT
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowPosition (100, 100);
glutInitWindowSize (winWidth, winHeight); // Set the initial Window’s width and height
glutCreateWindow (“Facial Expression Recognition Project”);// Create window with the given titleglutDisplayFunc (display); // Register callback handler for window re-paint event
glutMainLoop ( ); // Enter infinitely event-processing loop
}
Could it be the display function or it is something else?