Hullo.
I''m trying to make a starfield populated with textured and blended quads. The stars get bigger when you''re close by, and the blending makes lots of stars together seem a lot brighter. Overall, the visual effect is pleasing, so I don''t want to change that.
Although it looks good enough, it''s quite slow. On my K6/2-450Mhz w/Voodoo4, I can get around 1000 stars at a reasonable framerate. I haven''t measured it, but I''d guess it''s around 30.
However, I''d _like_ more stars: 3000 or 5000. I can do that, quite zippily, if I forgo some of the transformations. Here''s a summary of what happens atm:
Translate the field away from the viewer.
Rotate the field.
For Each Star:
glPushMatrix
Translate to The Star''s Position
Rotate the star so that it''s facing the viwer
Draw It.
glPopMatrix
The trouble is that the transformations in the loop slow everything down. I''m using three glRotatef calls for each iteration (and a glTranslatef), and it seems to me that there must be a way of converting three rotations around the canonical axes into one rotation around a different axis.
If I don''t do the transformations, the stars don''t face towards the viewer: when the starfield is rotated 90 degrees you''re looking at the quads side on and the effect is not pleasing, to say the least. So I have to do the transformations in some form.
I''ve tried without the matrix stack operations - just reversing the rotations and translations at the end of each iteration.
Translate to The Star''s Position
Rotate around x, y, z
Draw It.
Unrotate around z, y, z
Untranslate
It''s a little bit slower. If the six rotations can be condensed into two operations, that''d probably be better.
It just occured to me that using the second method I could precalculate the translation from one star to the next, and thusly avoid the untranslate.
One solution I tried was creating a display list of the star field. The list was made just fine, but when I play it back, it ignores any rotations I''ve applied to the modelview matrix. Is that how display lists are meant to operate, or must I be doing something wrong?
Just Plain Wrong