Latest Posts

Changes in ImplementOpenGl

Revision Differences of Revision 5

# Status ¶

## Current State ¶
- Experimental:
I pushed a first Version where opengl rendering worksOpenGL 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.

The Code compiles and linkGame and minimap drawing is in an own class.
- The menu works completely for sdl and partly with opengl. ¶
The game and terrain renderer does not work for opengl or sdl
- Text rendering works only partly. ¶

## Working on ¶

- Fix terrain/game reThinking about how to handle some things independent of underlying for sdl and implementgraphics (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 ¶
- reimplement drawing the minimap ¶
- merge with trunk and modify cmake ¶

(gameview and minimap will get their own class soon) ¶

# Howto test it: ¶
This branch is outdated. It's a proof of concept only. ¶

- get the branch ¶
- create a build directory ¶
- run make us usual ¶

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

# 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
mentu. ¶

## 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](