Status Report

I have created a new class “OpenGLSDLGraphicsManager”, which is a subclass from the OpenGLGraphicsManager. This way, I will not mix SDL code, and so allow other backends to make use from the OpenGLGraphicsManager.

I had some problems with how the OpenGLSDLGraphicsManager and the SDLGraphicsManager worked with the SDL backend. I need that both managers be able to work with the SDL backend and that implies that they need to be able to work along with the other SDL managers.

The problem is that the SDL event manager needs to get access to some intern data and call some functions from the graphics manager. So, I need to have some extra public functions declared in the SDL graphics managers that are not the ones called from OSystem.

For allowing the SDL event manager to call these functions, my first approach was to create an abstract “BaseSdlGraphicsManager”, which would be parent from SdlGraphicsManager and OpenGLGraphicsManager. However, this would lead to class ambiguity and a inheritance diamond problem. Not something really nice.

Finaly, I decided to move those functions to the virtual GraphicsManager class. This will polute a bit the GraphicsManager, as some other backends may not need to use those functions. However, any other way for resolving this would be much more complex and would not be really worth the problem.

Another solution, could have been to move those functions to OSystem_SDL, and include in each one a condition like:

1 if (_graphicsManagerType == kOpenGL) {
2  ((OpenGLSDLGraphicsManager  *)_graphicsManager)->callFunction(arg1, arg2, ...);
3 else if (_graphicsManagerType == kSDL) {
4  ((SDLGraphicsManager  *)_graphicsManager)->callFunction(arg1, arg2, ...);
5
6 }

But that is not very elegant…

Also, I implemented the PixelFormat related functions, and changed how the GLTexture class manages the pixel format. Now GLTexture setups its pixel format from the constructor insteand of having multiple classes for each format.

And, after implementing the GFX functions, at last I could make a blank opengl screen to pop up in my screen. Still nothing is blitted into the screen, but that will be the next step 🙂

So, for this week, I plan to implement the drawing to the screen. That will be the main task, but I plan to do some cleanup and improve the actual code as well (It is a bit messy in some parts)