Game Development Community

dev|Pro Game Development Curriculum

Torque 2D GFX: The Ash Heap of History

by Paul Jan · 08/11/2013 (11:12 pm) · 3 comments

For some reason GLKBaseEffect would generate malloc crashes during prepareToDraw. I'm still not sure why this was happening, but after taking it out, iOS is stable again. Back to using normal OpenGLES20 shaders.

C++11 and the standard template library
At the same time, I took this as an opportunity to redo the vector template as a wrapper for the std::vector template. Swapping between iterators and pointers really gives me the creeps in a post-32bit world. Since almost everything that used a vector iterator needed converting, the joys of the c++11 auto reference and range-based for() came in really handy. I'm not sure how much this is just newness for newness sake, but I feel a lot better for doing it. One casualty was the VS2010 build: since I never updated it to use GFX, I'm not going to miss it. Lots of the collection classes got trashed as redundant.

Tickable GUI
One thing I'm doing is making the GuiControl class use Tickable by moving the GuiTickCtrl functions into GuiControl. Coming out of this is a guiMoveCtrl class that can be moved around like the SceneWindow camera. I plan to expand the guiProgressCtrl into something that can be a more attractive health bar or a visual timer.

One rendering feature added is Scene::CameraPositionScale(int layer, float x, float y) which allows defining of a scaling vector for the camera. For example, background images could go in a layer with (0.0, 0.0), so that no matter where the camera goes, the background doesn't move. By slowing increasing the values with additional layers, we create a 2d parallax effect where objects further away (nearing the background) move less as the camera moves.

#1
08/12/2013 (11:27 pm)
Thanks for the update Paul. I downloaded your branch a few days ago but it kept crashing on startup (OSX). I don't remember the exact error message, I'll have to look at it again.

The camera position scale sounds neat, have you pushed that code to Github? At first glance I didn't see it.
#2
08/13/2013 (2:50 pm)
OSX should be fairly stable. Windows has a crash bug when you try to close the executable.

Camera position scaling has been in there for a while, accessible through the consoleMethod Scene::setCameraPositionScale(layer, x, y)

My current branch is gfx-glfw. I should probably merge it down into the base gfx branch but I'm waiting until I can resolve the windows bug.

I'm taking another swing at figuring out why the filterAsset doesn't work on OSX.
#3
08/15/2013 (2:49 pm)
The filter crashes in osx seem to be linked to the creation of CIContext from OpenGL contexts, so thats bad news for reading directly from ogl buffers. As a workaround, I load the images for the filterasset from the file instead. I guess I'll have to use readpixels to pull out texture data from buffers as well and see just how bad the performance hit is. On iOS these problems don't exist.