Greetings all, still a newbie here and at OpenGL in general.
Anyways my question is about a series of objects (GL_POINTS in this case) that have different Z-axis depths. I am trying to make a simple starfield that you can go through and have the stars fly by you. I am able to draw everything, and every star has a different random depth, but unfortunately when I go into the starfield, it seems that only the X and Y axes are being manipulated, and not the Z-axis.
Here is my code:
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_POINTS);
glVertex3f(starX[i]-3,starY[i]-3,-starZ[i]);
glEnd();
glutSwapBuffers();
}
void keyboard(unsigned char key, int x, int y)
{
switch(key)
{ /* fly in */
case 'f':
glScalef(1.01,1.01,1.01);
break;
/* fly out */
case 'F':
glScalef(0.7,0.7,0.7);
break;
/* rotaters: */
case 'w':
glRotatef(1.0,1.0,0.0,0.0);
break;
case 's':
glRotatef(-1.0,1.0,0.0,0.0);
break;
case 'a':
glRotatef(-1.0,0.0,1.0,0.0);
break;
case 'd':
glRotatef(1.0,0.0,1.0,0.0);
break;
}
display();
}
As I said above, it looks like only the X and Y are changed and not the Z. The depth of the entire starfield is very deep, but it only takes a few seconds to travel through the entire thing (which it shouldn’t). I was under the impression that this would work, however apparently I am missing something here.
On another note, I have glOrtho set to:
glOrtho(-10.0,10.0,-10.0,10.0,-100.0,10000000000.0);
So I know that it should be able to display all of the stars no matter where I am at (so long as I did not do something totally wring in glOrtho and am just not seeing it).
If anyone has any ideas as to what is wrong here, the help will be gladly appreciated.