Hi, I am doing a student project and I am doing a little “game” in Visual Studio with C++. I would like to create a grid surface up and down a spaceship. I tried the code below and it works.
void Grid::render() {
glPushMatrix();
glBegin(GL_LINES);
glColor3f(1.0f, 1.0f, 1.0f);
glTranslatef(100.0f, 100.0f, 100.0f);
for (int i = -size; i <= size; i++)
{
glVertex3f((float)i, 0, (float)-size);
glVertex3f((float)i, 0, (float)size);
glVertex3f((float)-size, 0, (float)i);
glVertex3f((float)size, 0, (float)i);
}
glEnd();
glPopMatrix();
}
I would like to move the grid. Modify the grid position, but I don’t know how. What instruction should I use and how? I tried to upload a picture in case I haven’t explained myself properly, but for some reason I can’t do it. I expect I have explained correctly.
Thanks in advance!