Q2. a) Use an appropriate OpenGL primitive to draw the shape given below:
- Use `GL_POLYGON` for drawing a single, filled, convex polygon.
- Vertices are specified between `glBegin(GL_POLYGON)` and `glEnd()` calls.
- Use `glVertex2f(x, y)` to define 2D coordinates for each vertex.
- OpenGL automatically connects the last vertex to the first, closing the shape.
Answer: To draw a simple, filled, convex polygon, the `GL_POLYGON` primitive is an appropriate OpenGL choice. This primitive allows defining a single polygon by specifying an ordered sequence of its vertices, which OpenGL then connects to form a closed, filled shape. The basic implementation involves enclosing vertex specifications between `glBegin(GL_POLYGON)` and `glEnd()` calls. For example, `glBegin(GL_POLYGON); glVertex2f(x1, y1); glVertex2f(x2, y2); glVertex2f(x3, y3); glEnd();` would draw a fill...