GLfloat zoomFactor = 0.2, rotateFactor = 0.5;
/* Beginning width, height */
-int width = 500, height = 500;
\ No newline at end of file
+int width = 500, height = 500;
+
+/* Texture state tracking */
+int currentGroundTexture = 0, currentMeshTexture = 0;
\ No newline at end of file
extern GLfloat zoom, rotate;
extern GLfloat zoomFactor, rotateFactor;
+/* Texture state tracking */
+extern int currentGroundTexture, currentMeshTexture;
+
#endif /* GLOBALS_H */
\ No newline at end of file
* Draw a floor by looping over the floorSize and squareSize variables
*/
void drawFloor() {
- getTexture(2);
- glBindTexture(GL_TEXTURE_2D, 2);
+ getTexture(currentGroundTexture);
+ glBindTexture(GL_TEXTURE_2D, currentGroundTexture);
glBegin(GL_QUADS);
for ( int x = -floorSize; x < floorSize; x++ ) {
for ( int z = -floorSize; z < floorSize; z++ ) {
* @param id ID of ground texture selected\r
*/\r
void processGTextureEvents(int id) {\r
-\r
+ currentGroundTexture = id;\r
+ glutPostRedisplay();\r
}\r
\r
/**\r
//glutAddMenuEntry("Rotation/Texture Scale", M_ROTATION_TEXTURE_SCALE);\r
//glutAddSubMenu("Material", materialMenu);\r
//glutAddSubMenu("Texture", textureMenu);\r
- //glutAddSubMenu("Ground texture", gTextureMenu);\r
+ glutAddSubMenu("Ground texture", gTextureMenu);\r
//glutAddSubMenu("Lights", lightMenu);\r
glutAddMenuEntry("Exit", M_EXIT);\r
\r