Dev Session Notes 10/12/06 - WSoft 101 Intro (Zenilib
Tutorial 1)
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:
- In Visual Studio open "Application/Source Files/Gamestate_One.cpp"
- Find a spot before the line containing "namespace Zeni {"
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); vr.render(triangle); } };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.
Find the definition of the function "void Gamestate_One::perform_logic()".
Change "Play_State" to "Simple_Rendering_State".
- Optional: Change the titles as desired.
- Save and Build
- Run
Note: views and opinions expressed in this article are the author's and are not necessarily those of Wolverine Soft.
