Latest Posts

Changes in ImplementOpenGl

Revision Differences of Revision 6

# Status ¶

## Current State ¶
-
ExperimentalTesting: OpenGL and SDL Software rendering is implemented in different classes now. OpengGL is partly working. ¶

The restructuring of the renderer: ¶

- OpenGL and SDL is separated now. ¶
- Class Surface is virtual. ¶
- Game and minimap drawing is in an own class. ¶
- The menu works completely for sdl and partly with opengl. ¶
- terrain renderer does not work for opengl ¶
- Text rendering works only partly. ¶

## Working on ¶
- Thinking about how to handle some things independent of underlying graphics (blitting, copying, resizing) ¶
- implement terrain rendering for opengl ¶
- Fix rest of the font/text rendering code ¶
- clean up a lot ¶

## To be done ¶
- fix text/font handling ¶
- reimplement drawing the game
It's playable with opengl and sdl now. ¶

Most parts work now. Text rendering and ui caching need some work. ¶

## ToDo ¶
- Fix rest of the font/text rendering code ¶
- clean up and comment a lot ¶
- fix caching of some ui elements. (Buttons work, listselect look strange with sdl and rest does no caching)


# Howto test it: ¶

check out the branch and compile just as trunk. Cmake enables opengl support if libraries and headers are found. OpenGL/SDL can be switched with --opengl=[0|1] or in the advanced options menu. ¶

## Implementation ¶
The current code relies on SDL software rendering a lot. The class Surface is used for image handling and rendering. This class exposes some SDL internals to widelands and these are use in some places. There is a class Graphic which is the main interface between widelands and the graphic system. Currently there is some game related code in the Surface, Graphic and Rendertarget classes. ¶

The first step was making Surface a Virtual base class which does not expose any SDL internal to the rest of widelands. There are two classes which inherit from Surface and implement actual renderers. They are called SurfacedSDL and SurfaceOpenGL. Everything from the game should use only the virtual class Surface and the global object g_gr of class Graphic. Graphic will have methods to create Surfaces and to Load Images to Surfaces. Rendering the game and the minimap code is currently scattered somehow over some classes and source files. I will move this code to an own class. ¶

Everything related to rendering now goes to graphic/render subdirectory. Everything else except some classes from graphic/ subdirectory (Graphic and perhaps font_handler) should not know anything about these different renderers. ¶

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