Category Archives: Tutorial

OpenGL 2D Facade (16): Text renderers

Before going to text with mixed styles, we need a better solution to render characters. In this post, I propose an approach based on the Composite pattern that allows an effortless combination of text styles. Objective Thanks to this new … Continue reading

Posted in Tutorial | Tagged , , , | Leave a comment

OpenGL 2D Facade (15): Text styles

In this post, I present text rendering with different styles (bold, italic, underline, …). Some of them are straightforward to implement thanks to Pygame; the others are more tricky! This post is part of the OpenGL 2D Facade series Objective … Continue reading

Posted in Tutorial | Tagged , , | Leave a comment

OpenGL 2D Facade (14): Unicode text

The creation of a tileset for large character sets uses a lot of memory. This post shows an approach based on the Flyweight pattern to allow their usage with minimal memory footprint. This post is part of the OpenGL 2D … Continue reading

Posted in Tutorial | Tagged , , | Leave a comment

OpenGL 2D Facade (13): Text

In this post, I start to address a more advanced topic: text rendering with OpenGL. I first consider a simple case with monospaced fonts and small character sets. This post is part of the OpenGL 2D Facade series Objective To … Continue reading

Posted in Tutorial | Tagged , | Leave a comment

OpenGL 2D Facade (12): Characters

In this post, I add a new type of layer dedicated to characters. These layers can draw tiles anywhere and updates their OpenGL data every time we render a frame. This post is part of the OpenGL 2D Facade series … Continue reading

Posted in Tutorial | Tagged , | Leave a comment

OpenGL 2D Facade (11): View and Keyboard

With the previous program, the size of the window depends on the size of the level, which is problematic when the level is large. In this post, I update the shader programs to get a fast translation of the display. … Continue reading

Posted in Tutorial | Tagged , , | Leave a comment

OpenGL 2D Facade (10): Layers

In this post, we extend the facade to handle several layers. We also see how to draw with transparency.

Posted in Tutorial | Tagged , , | Leave a comment

OpenGL 2D Facade (9): Load a level

Before handling the rendering of several layers, we need data to build them. Rather than copy and paste many ids from a Tiled map file, I propose to read them using the TMX library.

Posted in Tutorial | Tagged , , | Leave a comment

OpenGL 2D Facade (8): Facade

I have enough content to start a facade: I refactorize all the code to satisfy the properties of the Facade pattern and get a more robust and extensible implementation.

Posted in Tutorial | Tagged , , , | Leave a comment

OpenGL 2D Facade (7): Draw a level

In this post, I show how to draw many tiles from a single-layer level created with Tiled. I also show how to take a screen capture with OpenGL.

Posted in Tutorial | Tagged , | Leave a comment