My Games

Classic Lines

Classic Lines was the application I learned OpenGL with. The game is simple, but it utilizes the most of basic OpenGL ES 2.0 (and partially 3.0) techniques:

  • MVP matrix. In 3D version of the game the projection matrix is calculated depending on the window size (viewport).
  • All the objects including the board, balls, path arrows, sparkles, explosion particles sit in vertex buffers and are rendered with vertex/fragment shaders.
  • The light is implemented with common fragment shader calculating ambient, specular and diffuse coefficients. The sparkle position is found by iterating over the normals and searching the maximum light coefficient.
  • The antialiasing is achieved by rendering the scene first to 4 times bigger offscreen buffer and then rendering the buffer to the screen with multisampling.
  • Color coding is used to determine what object the user has clicked on. The board and the balls are rendered first with alpha containing the object identifier (that is why the board size is limited with 15×15), then alpha is erased and the background is rendered using stencil buffer and specific blending operation.
  • Textures are used for rendering the background images, sparkles and particles.
  • All the rendering is done on a separate thread and the swaps (flips) are synchronized with the monitor refresh cycles. This prevents screen tearing and saves the battery power.

Lines Game is available on Windows Store (3D version) and Google Play (2D version) .

While the both Windows and Android versions are written in C++ and use common cross-platform game logic and rendering code, Android version is a QT application that combines QML controls with the scene rendered with raw OpenGL ES calls, but Windows version is developed with MS Visual Studio 2015 and uses ANGLE and XAML.