diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/glcheck.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/src/glcheck.c b/src/glcheck.c index c614f62..d63e5cd 100644 --- a/src/glcheck.c +++ b/src/glcheck.c @@ -102,6 +102,7 @@ static void glcheck_setup() { static void glcheck_draw() { GLfloat white[] = { 1.0, 1.0, 1.0, 1.0 }; + GLfloat black[] = { 0.0, 0.0, 0.0, 1.0 }; glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glEnable(GL_DEPTH_TEST); @@ -118,14 +119,16 @@ static void glcheck_draw() { 0.0, 1.0, 0.0); glEnable(GL_LIGHTING); - GLfloat pos[] = { 0.0, 0.0, -2.0, 0.0 }; - GLfloat diffuse[] = { 1.0, 1.0, 1.0, 1.0 }; - GLfloat specular[] = { 1.0, 1.0, 1.0, 1.0 }; - GLfloat ambient[] = { 1.0, 1.0, 1.0, 1.0 }; - glLightfv(GL_LIGHT0, GL_POSITION, pos); - glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse); - glLightfv(GL_LIGHT0, GL_SPECULAR, specular); - glLightfv(GL_LIGHT0, GL_AMBIENT, ambient); + GLfloat ambient[] = { 0.2, 0.2, 0.2, 1.0 }; + glLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambient); + GLfloat pos0[] = { 0.0, 0.0, -2.0, 0.0 }; + GLfloat diffuse0[] = { 1.0, 1.0, 1.0, 1.0 }; + GLfloat specular0[] = { 1.0, 1.0, 1.0, 1.0 }; + GLfloat ambient0[] = { 0.0, 0.0, 0.0, 0.0 }; + glLightfv(GL_LIGHT0, GL_POSITION, pos0); + glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse0); + glLightfv(GL_LIGHT0, GL_SPECULAR, specular0); + glLightfv(GL_LIGHT0, GL_AMBIENT, ambient0); glEnable(GL_LIGHT0); glRotatef(angle, 0.0, 1.0, 0.0); @@ -135,6 +138,7 @@ static void glcheck_draw() { glEnable(GL_COLOR_MATERIAL); glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE); glMaterialfv(GL_FRONT, GL_SPECULAR, white); + glMaterialfv(GL_FRONT, GL_EMISSION, black); glMaterialf(GL_FRONT, GL_SHININESS, 80.0); glColor3f(0.0, 0.0, 1.0); glutSolidTeapot(0.5); @@ -154,6 +158,7 @@ void glcheck_update() { int main(int argc, char *argv[]) { int window; + GLint var; glutInit(&argc,argv); glutInitDisplayMode(GLUT_RGBA | GLUT_DEPTH | GLUT_DOUBLE); @@ -161,8 +166,11 @@ int main(int argc, char *argv[]) { window = glutCreateWindow("Thrust3D GLcheck"); glewInit(); - glcheck_setup(); + + glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, &var); + printf("%i\n", var); + glutTimerFunc(10.0, glcheck_update, 0.0); glutDisplayFunc(glcheck_draw); glutMainLoop(); |