Donation

Help us to pay our server!
(: Consider a donation :)



Social Media

  • Facebook
  • Google+

Latest Posts

ImplementOpenGl

Status

Current State

The code is in trunk now. But the opengl rendering is still marked experimental.

ToDo

  • Fix rest of the font/text rendering code
  • fix caching of some ui elements. (Buttons work with sdl and rest does no caching)
  • 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

The old code relied on SDL software rendering a lot. The class Surface was used for image handling and rendering. This class exposed some SDL internals to widelands and these were used in some places. There is a class Graphic which is the main interface between widelands and the graphic system. There was 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 is done in a class GameView now. The game rendering code is still somehow hacked together. This should be cleaned up a bit like the surface class.

Everything related to rendering now is 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