Archived

This topic is now archived and is closed to further replies.

branhield

uuh..background stuff

Recommended Posts

i need a star background for my spaceshooter 2d game...and i want the stars to move, so i get ''ship-is-moving'' effect...advice plz..

Share this post


Link to post
Share on other sites
make the background on a texture eg 512x512 repeat texture
+ for sideways scrolling of 1 texel per frame use

static float posx=0.0;
static float offset=(1.0/512.0);

posx+=offset;
if ( posx>1.0 )
posx-=1.0;
glBegin( GL_QUADS );
glTexCoord2f(0+posx,0);
glTexCoord2f(0+posx,1);
glTexCoord2f(1+posx,1);
glTexCoord2f(1+posx,0);
glEnd();

http://uk.geocities.com/sloppyturds/gotterdammerung.html

Share this post


Link to post
Share on other sites
If the quad takes up the entire screen and is textured, it could slow down the app. Instead, I would go about rendering multiple, seperate quads, with the ability to change the array size during run time. (assuming you use an array)

[edited by - masterg on May 3, 2002 6:53:13 PM]

Share this post


Link to post
Share on other sites