Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void processTriangleClicks(GLint x, GLint y) {
- static GLintPoint triangleFirstPoint;
- static GLintPoint triangleSecondPoint;
- y = gWinHeight - y; // invert y position
- if (shapeClickCount == 0) { //first click
- triangleFirstPoint.x = x;
- triangleFirstPoint.y = y;
- shapeClickCount++ ;
- }
- else if (shapeClickCount == 1) { //second click
- triangleSecondPoint.x = x;
- triangleSecondPoint.y = y;
- printf("First Point: %i %i \n", triangleFirstPoint.x, triangleFirstPoint.y);
- printf("Second Point : %i %i \n", triangleSecondPoint.x, triangleSecondPoint.y);
- shapeClickCount++ ;
- }
- else if (shapeClickCount == 2) {
- shapeClickCount = 0;
- glBegin(GL_TRIANGLES); // draw line using coords when button last pressed
- glVertex2i(triangleFirstPoint.x, triangleFirstPoint.y);
- glVertex2i(triangleSecondPoint.x, triangleSecondPoint.y);
- glVertex2i(x, y);
- glEnd();
- }
- glFlush();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement