Another GLUT Question?

Why dosent this light my cube up?


#ifdef __APPLE__
#include <GLUT/glut.h>
#else
#include <GL/glut.h>
#endif

#include <stdlib.h>

float yup = 0.0f;
float ydown = 0.0f;


void KeyUp(int key, int x, int y){

ydown = ydown + 0.5f;

}


void cube(void){
glRotatef(ydown,0.0f,0.0f,0.0f);
glColor3f(0.0, 0.0, 1.0);
glutSolidCube(1);
}

void init(void){
glColor3f(1.0f,1.0f,1.0f);
glClearDepth(1);
glEnable(GL_DEPTH_TEST);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_COLOR_MATERIAL);
glColor3f(1.0f,1.0f,0.0f);
}

void display(void){
glClearColor(1.0f,1.0f,1.0f,1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glLoadIdentity();
cube();
glutSwapBuffers();
}

int main(int argc, char **argv) {

glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);
glutInitWindowPosition(100,100);
glutInitWindowSize(320,320);
glutCreateWindow("Dimension");
init();
glutDisplayFunc(display);
glutIdleFunc(display);

glLoadIdentity();

glutSpecialFunc(KeyUp);

glutMainLoop();

return 0;
}
Topic archived. No new replies allowed.