Jump to content
  • Advertisement

Archived

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

branhield

uuh..background stuff

This topic is 5924 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!