void processTextureEvents(int id) {\r
if ( curObject >= 0 ) {\r
sceneObjs[curObject].texture.id = id;\r
+ sceneObjs[curObject].texture.scale = 1;\r
glutPostRedisplay();\r
}\r
}\r
}\r
}\r
\r
-/**\r
- * Keybord event handler\r
- * w/s increase/decrease the z\r
- * a/d increase/decrease the x\r
- * q/e increase/decrease the y\r
- * z/x increase/decrease the angle\r
- * @param key Key pressed\r
- * @param x x co-ordinate of mouse\r
- * @param y y co-ordinate of mouse\r
- */\r
-void keyboard(unsigned char key, int x, int y) {\r
- switch(key) {\r
- case 'w':\r
- case 'W':\r
- camz -= factor;\r
- break;\r
- case 'a':\r
- case 'A':\r
- camx -= factor;\r
- break;\r
- case 's':\r
- case 'S':\r
- camz += factor;\r
- break;\r
- case 'd':\r
- case 'D':\r
- camx += factor;\r
- break;\r
- case 'q':\r
- case 'Q':\r
- camy += factor;\r
- break;\r
- case 'e':\r
- case 'E':\r
- camy -= factor;\r
- break;\r
- case 'z':\r
- case 'Z':\r
- keyrot += factor;\r
- break;\r
- case 'x':\r
- case 'X':\r
- keyrot -= factor;\r
- break;\r
- case '=':\r
- case '+':\r
- factor += 0.1;\r
- printf("Factor of change is now %f\n", factor);\r
- break;\r
- case '-':\r
- case '_':\r
- factor -= 0.1;\r
- printf("Factor of change is now %f\n", factor);\r
- break;\r
-\r
- }\r
- printf("Camera is now at (%f, %f, %f), angle %f\n", camx, camy, camz, keyrot);\r
- glutPostRedisplay();\r
-}\r
-\r
/**\r
* Called when motion event occurs\r
* @param x Mouse x position\r
sceneObjs[curObject].rotation.x += diffx * rotateFactor;\r
\r
// h: texture scale\r
+ // **NOTE: Seems to be problem with scaling, delayed action\r
float max = (float)height/texscaleFactor;\r
- float scaling = (diffy + max) / max;\r
+ float scaling = (-diffy + max) / max;\r
sceneObjs[curObject].texture.scale *= scaling;\r
\r
}\r
\r
glPushMatrix();\r
\r
- /* Perform scene rotations based on user mouse/keyboard input. */\r
+ /* Perform scene rotations based on user mouse input. */\r
glRotatef(rotate*camRotateFactor, 0.0, 1.0, 0.0);\r
- glTranslatef(camx, camy, camz);\r
- glRotatef(keyrot, 1.0, 0.0, 0.0);\r
\r
drawFloor();\r
\r
glDepthRange(0,1);\r
glEnable(GL_DEPTH_TEST); // Enables Depth Testing\r
glDepthFunc(GL_LEQUAL); // the type\r
- glEnable(GL_CULL_FACE);\r
- glLineWidth(2.0);\r
+ //glEnable(GL_CULL_FACE);\r
+ glLineWidth(1.0);\r
\r
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);\r
\r
glutReshapeFunc(windowReshape);\r
glutDisplayFunc(display);\r
glutMouseFunc(mouse);\r
- glutKeyboardFunc(keyboard);\r
glutMotionFunc(motion);\r
\r
makeMenu();\r