PDA

View Full Version : simulating stars at infinity



Goliath
11-15-2000, 12:28 AM
I want to simulate stars that look far off. Whenever I draw the stars (the procedure called by glutDisplayFunc() ), I want to use gluPerspective and set the far clipping plane to some huge number, draw the stars and then return the clipping planes to their previous values to draw other things close up. However when I do this, I end up seeing nothing. Any suggestions on how to go about doing this? Some example code would help greatly.

joat
11-15-2000, 05:39 AM
This might work (pseudocode)

begin
glLoadIdentity
gluLookAt(origin, rot, up...)
disable GL_DEPTH_TEST
render all of your stars on a 1 unit radius sphere (distance doesn't matter IIRC)
enable GL_DEPTH_TEST

glLoadIdentity
gluLookAt(pos, rot, up)
render the rest of your screen
end

This is like drawing a skybox, you rotate the infinity stuff, but do not translate it, and you draw it with depth testing turned off.
Then redo your modelview with both the position and rotation and draw the rest of the universe.

[This message has been edited by joat (edited 11-15-2000).]