Latest Posts

Changes in ImplementOpenGl

Revision Differences of Revision 7

# Status ¶

## Current State ¶
- Testing: OpenGL and SDL Software rendering is implemented in different classes now. It's playable wiThe code is in trunk now. But the opengl and sdl now. ¶

Most parts work now. Text rendering and ui caching need some work.
rendering is still marked experimental.

## 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.
- plan a nice opengl terrain renderer ¶

# Howto test it: ¶

OpenGL/SDL can be switched with --opengl=[0|1] or in the advanced options menu. ¶

## Implementation ¶
currentold code reliesd on SDL software rendering a lot. The class Surface iwas used for image handling and rendering. This class exposesd some SDL internals to widelands and these awere used in some places. There is a class Graphic which is the main interface between widelands and the graphic system. Currently tThere iwas 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 is done in a class GameView now. The game rendering code is still somehow hacked together. This should be cleaned source files. I will move this code to an ownup a bit like the surface class. ¶

Everything related to rendering now
goes tois in 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](

[OpenGL blueprint]( ¶
[OpenGL Terrain blueprint](