Wednesday 25 March 2009

A minor victory

Apologies for the delay between posts. Had to move flat and so programming took a bit of a backseat. After trying to squash the draw error using various methods I've finally made some progress using masking. I can now redraw the entire area occupied by a sprite correctly with any overlapping objects drawn either behind or in front without any issues. As a result I can also implement a dirty rect system for redrawing objects. The plan is to create a grid of rectangle. When anything moves a flag is switched on the relevant grid locations and all objects that are within those sections are redrawn. Should save a lot of time when it comes to drawing any scene. Current concerns lie with scrolling. If the user scrolls the scene then everything will need redrawing and since the camera will probably lock onto the player this means full redraw with every movement. I'm sure there's a way of shifting the colour buffer so that the OpenGL moves the ready drawn scene and the only redraw will be things coming into view. Right now I've got other stuff to worry about.