+ else
+ {
+ dragging = 0;
+ }
+}
+
+void TestGLCanvas::InitMaterials()
+{
+ static const GLfloat ambient[4] = {0.1f, 0.1f, 0.1f, 1.0f};
+ static const GLfloat diffuse[4] = {0.5f, 1.0f, 1.0f, 1.0f};
+ static const GLfloat position0[4] = {0.0f, 0.0f, 20.0f, 0.0f};
+ static const GLfloat position1[4] = {0.0f, 0.0f, -20.0f, 0.0f};
+ static const GLfloat front_mat_shininess[1] = {60.0f};
+ static const GLfloat front_mat_specular[4] = {0.2f, 0.2f, 0.2f, 1.0f};
+ static const GLfloat front_mat_diffuse[4] = {0.5f, 0.28f, 0.38f, 1.0f};
+ /*
+ static const GLfloat back_mat_shininess[1] = {60.0f};
+ static const GLfloat back_mat_specular[4] = {0.5f, 0.5f, 0.2f, 1.0f};
+ static const GLfloat back_mat_diffuse[4] = {1.0f, 1.0f, 0.2f, 1.0f};
+ */
+ static const GLfloat lmodel_ambient[4] = {1.0f, 1.0f, 1.0f, 1.0f};
+ static const GLfloat lmodel_twoside[1] = {GL_FALSE};
+
+ glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
+ glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
+ glLightfv(GL_LIGHT0, GL_POSITION, position0);
+ glEnable(GL_LIGHT0);
+
+ glLightfv(GL_LIGHT1, GL_AMBIENT, ambient);
+ glLightfv(GL_LIGHT1, GL_DIFFUSE, diffuse);
+ glLightfv(GL_LIGHT1, GL_POSITION, position1);
+ glEnable(GL_LIGHT1);
+
+ glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);
+ glLightModelfv(GL_LIGHT_MODEL_TWO_SIDE, lmodel_twoside);
+ glEnable(GL_LIGHTING);
+
+ glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, front_mat_shininess);
+ glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, front_mat_specular);
+ glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, front_mat_diffuse);