glLoadIdentity();
glDisable(GL_LIGHTING);
glPointSize(0.5);
glLineWidth(0.5);
glRotatef(xRot, 1.0f, 0.0f, 0.0f);
glRotatef(yRot, 0.0f, 1.0f, 0.0f);
static const int size = 150;
static const int step = 50;
glColor4f(1, 0, 0, 0.2);
for (int x = -size; x <= size; x += step) {
for (int y = -size; y <= size; y += step) {
glBegin(GL_LINES);
glVertex3f(x, y, -size);
glVertex3f(x, y, size);
glEnd();
}
}
glColor4f(0, 1, 0, 0.2);
for (int z = -size; z <= size; z += step) {
for (int y = -size; y <= size; y += step) {
glBegin(GL_LINES);
glVertex3f(-size, y, z);
glVertex3f(size, y, z);
glEnd();
}
}
glColor4f(0, 0, 1, 0.2);
for (int x = -size; x <= size; x += step) {
for (int z = -size; z <= size; z += step) {
glBegin(GL_LINES);
glVertex3f(x, -size, z);
glVertex3f(x, size, z);
glEnd();
}
}
float x = 0;
float y = 10;
float z = 60;
glBegin(GL_LINES);
glColor3f(1, 0, 0);
glVertex3f(0, 0, 0);
glVertex3f(x, y, z);
glEnd();
glEnable(GL_LIGHTING);