Sign in to follow this  
smc

2D Tile Engine - OpenGL

Recommended Posts

smc    292
I am a total newb with OpenGL. I am writing a 2D tile engine using OpenGL in orthographic rendering mode. I would like to support a parallax scrolling method. My question is: should I translate all the foreground geometry in real time and stagger the background geometry in something like a half or 3/4 step? Initially I translated the view with the player (in model view I believe), but this led to ad hock translation calls on the background geometry to get it to scroll slower then the foreground. I just figured it would be quicker and easier this way. edit... I guess to sum up my thoughts. Should I be translating the view or all the geometry. My map is composed of a number of textured boxes (glVertex2d). thanks. [Edited by - smc on April 24, 2008 12:56:22 AM]

Share this post


Link to post
Share on other sites
Wyrframe    2426
If you are faking parallax using orthographic projection, translating the world geometry piece by piece and translating the "camera" (really translating all world geometry in the opposite direction) will be indiscernable to the user. The latter (translate the camera and the distant background) will be lighter on math, though; so just do what you're doing.

You could also get a real parallax using a perspective camera and putting your background further away, of course.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this