Fixed object camera movement in OpenGL

Adfa6cf87d3749a0e1acd928285b3f23
0
WDR 106 Jan 31, 2014 at 17:02 camera opengl fixed-point

Hi… So, I tried to create a camera for my 2D game and came across this site… OpenGL Colony. I looked up the source code provided in the website to create a 3D camera and adapted a bit of it to create my own 2D camera. And it works perfectly. Only thing now is, I can’t figure out how to fix an object’s position relative to the camera. When I use the camera, the whole scene moves. The scene consists of three layers - background, midground, foreground. I want to move the camera in such a way that the background and foreground are stationary with respect to the camera’s movement and the midground moves when the camera is moved. In other words, the foreground and background objects are bound to the camera whereas the midground is not. How would I go about doing that? I couldn’t find much about it on the internet. Please help. Thank you.

1 Reply

Please log in or register to post a reply.

Adfa6cf87d3749a0e1acd928285b3f23
0
WDR 106 Feb 03, 2014 at 04:44

Come on, guys! Please help! :-(