WSoft 101 Intro (Tutorial 1):

  • Zenilib is a 3D game development library written by Mitchell Bloch. It uses OpenGL and Direct3D interchangably. The basis of WSoft101 will be learning the basics of game programming using this library.
  • Download the source code and supporting files from The Zenipex Library Homepage. This is also where you can find the doxygen-based documentation.

To compile in Visual Studio / Xcode:

Follow the Start Guide if you haven't already.

Rendering a triangle:

  1. Open "zenilib/jni/application/bootstrap.cpp"
  2. Find a spot before the line containing "namespace Zeni {"
  3. Add the following code for a new Gamestate:

    class Simple_Rendering_State : public Gamestate_Base {
      void render() {
        Video &vr = get_Video();
        Colors &cr = get_Colors();
        Vertex2f_Color p0(Point2f(0.0f, 0.0f), cr["red"]);
        Vertex2f_Color p1(Point2f(0.0f, 300.0f), cr["green"]);
        Vertex2f_Color p2(Point2f(400.0f, 0.0f), cr["blue"]);
        Triangle<Vertex2f_Color> triangle(p0, p1, p2);

    Note the counter-clockwise ordering of the vertices. If the ordering were clockwise, it would be considered back-facing. If you want the best performance, you should cull back facing polygons.

  4. Find the definition of the function "Bootstrap::Gamestate_One_Initializer::operator()()".

  5. Change "Play_State" to "Simple_Rendering_State".

  6. Optional: Change the titles as desired.

  7. Save and Build

  8. Run

Note: views and opinions expressed in this article are the author's and are not necessarily those of Wolverine Soft.