CPP
cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <GL/glew.h>
#include <GL/freeglut.h>
float angle = 0.0;
void myDisplay()
{
glClear(GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glRotatef(angle, 1.0, 1.0, 1.0);
angle += 0.5;
// Draw the selected shape here
glutSwapBuffers();
}
void init()
{
glClearColor(1.0, 1.0, 1.0, 0.0); // Set background color to white
}
void drawCube()
{
glColor3f(0.0, 0.0, 1.0); // Set shape color to blue
glutWireCube(1.0);
}
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run