PDA

View Full Version : Moving background



Black_Death
03-17-2003, 10:28 PM
I want to make moving background for my application. What do I have to do?

mikael_aronsson
03-17-2003, 11:24 PM
Hi !

I think you need to give some more info if you are gonna get any help.

Are you talking about a 2D image "background" or are you talking about geometry in the "background" ?

Some more details would help out here...

If you are talking about an image then I suggest that you create a quad, put the background as a texture on it and use that.

I assume only up/down movement here...

Make the texture say twice as high as the window, then you can simply move the quad to make it move up or down, the tricky part is that you will neeed one more quad to put a new texture on when you start to run out of image on the first, then you need to display the second in the right position to get nice seamless scrolling, when the first quad is no longer visible you can reuse that to load a third texture and so on.

This is just an idea, I am sure there are faster/better ways to do it.

The downside is that this will require pretty huge amounts of memory, another solution would be to create more quad, say 20-30 and use the same idea, but keeping track when the top quad goes out of screen you can reuse that to load a new texture and put at the bottom (if you scroll up that is), this would require much less memory (about the size of the screen + 20% maybe)

Mikael


[This message has been edited by mikael_aronsson (edited 03-18-2003).]