Question: #include GLfloat angle = 0 . 0 f; GLfloat scale = 1 . 0 f; GLfloat xTrans = 0 . 0 f; GLfloat yTrans =
#include
GLfloat angle f;
GLfloat scale f;
GLfloat xTrans f;
GLfloat yTrans f;
void init
glClearColor;
glMatrixModeGLPROJECTION;
glLoadIdentity;
gluPerspective;
glMatrixModeGLMODELVIEW;
glEnableGLDEPTHTEST;
void display
glClearGLCOLORBUFFERBIT GLDEPTHBUFFERBIT;
glLoadIdentity;
glTranslateffff;
glTranslatefxTrans yTrans, f;
glRotatefanglefff;
glScalefscale scale, scale;
glBeginGLQUADS;
glColorf;
glVertexf;
glVertexf;
glVertexf;
glVertexf;
glColorf;
glVertexf;
glVertexf;
glVertexf;
glVertexf;
glColorf;
glVertexf;
glVertexf;
glVertexf;
glVertexf;
glColorf;
glVertexf;
glVertexf;
glVertexf;
glVertexf;
glColorf;
glVertexf;
glVertexf;
glVertexf;
glVertexf;
glColorf;
glVertexf;
glVertexf;
glVertexf;
glVertexf;
glEnd;
glutSwapBuffers;
void updateint value
angle f;
if angle
angle ;
glutPostRedisplay;
glutTimerFunc update, ;
void specialKeysint key, int x int y
switch key
case GLUTKEYUP:
yTrans f;
break;
case GLUTKEYDOWN:
yTrans f;
break;
case GLUTKEYLEFT:
xTrans f;
break;
case GLUTKEYRIGHT:
xTrans f;
break;
glutPostRedisplay;
void keyboardunsigned char key, int x int y
switch key
case w:
case W:
yTrans f;
break;
case s:
case S:
yTrans f;
break;
case a:
case A:
xTrans f;
break;
case d:
case D:
xTrans f;
break;
case :
scale f;
break;
case :
scale f;
if scale f scale f;
break;
glutPostRedisplay;
int mainint argc, char argv
glutInit&argc, argv;
glutInitDisplayModeGLUTDOUBLE GLUTRGB GLUTDEPTH;
glutInitWindowSize;
glutCreateWindowLAB;
glutDisplayFuncdisplay;
glutSpecialFuncspecialKeys;
glutKeyboardFunckeyboard;
init;
glutTimerFunc update, ;
glutMainLoop;
return ;
Using your code from, implement a mouse click function. When the left mouse button is clicked, another shape with the same one you created is added to the clicked location and does the same animations as the original. For every click, create another shape.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
