PDA

View Full Version : Efficiant Parralax Scrolling



Spock
02-24-2009, 04:56 PM
Greetings...

Just wondering, what would be the most efficient way to implement parralax scrolling? --

1) Calcluate background offset from player position, relative to world map

2) Setup GL co-ordinates such that they match world map, and draw map from ( 0, 0 ) to ( mapWidth, mapHeight ).

3) Take advantage of the depth buffer somehow.. - I have heard of this, but I do not know how to set up co-ordinates such that the black 'offscreen' is not seen at any point on the map - i.e. so that there is always a part of the background drawn.

4) Different method/variation that I do not know ;)

Well, let me know, and thanks!

scratt
02-24-2009, 06:59 PM
Parallax scrolling of what?

If you render in 3D with the objects making up the scrolling portion of your view being drawn at different distances from the viewpoint then it will all be handled for you as you move your viewpoint and re-draw.

If however you are drawing Orthographically and want to scroll layers of bitmaps (textures on geometry) past then that's a sightly different proposition..

ZbuffeR
02-25-2009, 06:09 AM
3)how to set up co-ordinates such that the black 'offscreen' is not seen at any point on the map
Use alpha channel to mark transparent parts, then use blending.