Efficiant Parralax Scrolling

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 :wink:

Well, let me know, and thanks!

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…

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.