Latest Posts

Changes in ImplementOpenGl

Editor Comment

update what I do


Revision Differences of Revision 2

# Status ¶

## Current State ¶
- Experimental: I pushed a first Version where opengl rendering works ¶

## Working on ¶
- separating OpenGL code and SDL software rendering code

- throwing out the font code at least from the GL Path


## To be done ¶
- just to much ¶

# Howto test
it: ¶
- get the branch ¶
- create a build directory ¶
- invoke cmake /path/to/source -DCMAKE_CXX_FLAGS="-DUSE_OPENGL -DHAS_OPENGL" -DCMAKE_EXE_LINKER_FLAGS=-lGL ¶
- run make us usual ¶

Do not report bugs in the current state. At the moment it's just an experiment. ¶

## Implementation ¶
currently it is somehow mixed with the SDL software rendering code. It is done by choosing the OpenGL or the Software path based on a global variable (g_opengl). Most of the changes are in the classes Surface, Graphic and RenderTarget. The initialisation is done in Graphic. RenderTarget does some small things (Drawing lines) and renders the Game. Surface does blitting transform SDL_Surface to OpenGL textures. Pictures are read as without OpenGL as class Surface. If they are blitted using opengl, the SDL_Surface is transformed in an OpenGL Texture. The generated Texture is cached in the Surface. So the transformation occurs only once for every picture. The code works but is quite ugly. This is what is currently in the branch. ¶

That is what I do local: ¶

I made the class Surface virtual and disallow accessing the SDL_Surface directly. This class provides function to blit and draw primitives. This class is inherited by SurfaceOpenGL and SurfaceSDL. These implement the rendering code. This broke the code (of course). The worst thing is the font code. It relies on using the SDL_Surface. RenderTarget and Graphic needs some changes to reflect the changes to Surface. As soon as the code works with these changes again I will push to the branch. ¶

# Links ¶
[Branch on launchpad](https://code.launchpad.net/~timo-wingender/widelands/graphicsystem-opengl)