From WiiBrew
Jump to navigation Jump to search
Mgdl minilogo.png
TypeFramework library
VersionRelease 2.6

MTek-GDL is a simple object-oriented game development library written in C++ combined with a collection of tools, examples, and additional libraries for simple and advanced game development for the Nintendo Wii and PC (OpenGL) platforms and is ideal for beginners and advanced Wii game programmers... No longer do you have to (painfully) deal with low-level GX and other stuff to get something as simple as loading and displaying a png image file, unless you want to make good use of the Wii's graphics hardware in which case you'll have to learn how to use the GX but it'll be much easier to get started with using the GX with this library.

Even though this library is designed mostly for 2D game development, it can be used as a base for developing custom 2D and 3D graphics engines as an extension library... For convenience reasons, it is best to maintain such libraries separately from MTek-GDL to avoid interference.

For the most recent version of this library usually with new features and bug fixes not yet present in the official release packages of this library, head to the Github repository of this library. Be warned of possible syntax changes and read mgdl-main.h for the list of changes.


  • Graphics
    • Simplified system initialization automating video, GX, and audio subsystem initialization.
    • Well optimized hardware accelerated image and sprite drawing functions.
    • Built-in sprite sheets system for efficient sprites management.
    • HDTV friendly low-resolution mode (320x240/432x240 on NTSC/MPAL/EuRGB60, 320x264/432x264 on PAL) for retro style games and emulators.
    • Built-in texture conversion functions for I4, I8, IA4, IA8, RGB565, RGB5A3, and RGBA8 texture formats.
    • Built-in png image and tpl texture loading functions with mipmap support.
    • Simple font system for fixed-sized font sheets and variable-sized DirectQB fonts.
    • Take screenshots as png images.
  • Sound
    • Play uncompressed Microsoft format wav files with full stereo panning.
    • Stream music from ogg vorbis audio files.
  • Miscellaneous
    • Built-in power and reset button handling complete with fade-out.
    • Can be used as a base for advanced game engine development.
    • On-screen console mode for debugging purposes.
    • PC library included for porting Wii projects to the PC (albeit some functions are not present in this version due to platform differences).
    • Simple, efficient, and smaller code size than GRRLIB.

Example Screenshots

If you want to try out some of the examples that came with the MTek-GDL library without having to compile them yourself, you can find pre-compiled versions of some of the examples right here:

Associated Libraries

  • zlib
  • libpng
  • libtremor
  • oggplayer (modified for file streaming and reverse stereo bug fix)
  • valloc (from devKitPSP/PSPSDK modified for MEM2 memory management)
  • dolexec (based on FIX94's loadMii forwarder)


Release 2.6 (7-12-2015)

  • Small Wii library update.
  • Wii library v0.65 changes:
    • Fixed bug in gdl::PrepDisplay() where it won't reset the projection matrix to 2D.
    • Fixed a major low-resolution mode bug when the console is set for progressive-scan mode.

Release 2.5 (7-03-2015)

  • PC library temporarily dropped in this release due to major overhaul reasons. Most people who use MTek-GDL use the Wii version of this library anyway.
  • Added library installer batch program.
  • Wii library manual is now in a standalone .chm format file, fixed up the formatting a bit and made major corrections with the Wii specs documentation.
  • Included MTek-GDL logo as an .svg vector file for customization.
  • Updated wiimote.c controller handler in the examples to use a much more efficient way of querying Wiimote data.
  • Added slightly modified libogc library which disables memory allocation routines from jumping into MEM2 if MEM1 becomes full making dedicated MEM2 memory management much safer to do in memory intensive projects and a possible video init bug fix when your program is run on a WiiU under Wii mode.
  • Added MTek-GDL templates for CodeBlocks to ease creating projects with the Wii version of this library.
  • Spritesets and Whack-a-Cirra examples now run in low-res mode and fixed a bug in Whack-a-Cirra where if you plot a Cirra at the bottom most part of the screen, the game will freeze.
  • Increased oggplayer thread priority slightly to fix audio stutter issues when the main program is processing too much (one example is killing a boatload of Cirras in the Whack-a-Cirra minigame).
  • Wii library v0.65 changes:
    • Added gdl::SetErrorCallback() and gdl::CallErrorCallback() functions for custom error handling.
    • Added malloc2() and free2() alias macros to valloc() and vfree() as it makes a lot more sense naming wise.
    • Added out of memory checks in the gdl::Texture and gdl::Image classes.
    • Library can now be compiled as a precompiled binary library which makes compile times much faster and it improves documentation formatting as well. The old #include method will still work but your project will not compile as fast as with a precompiled version of the library.
    • Added gdl::Texture::CreateMipmapped(), gdl::Image::CreateMipmapped() and gdl::Image::LoadImageMipmapped() functions which finally adds built-in mipmap support to the library.
    • Fixed a bug in gdl::FFont class where the characters appear to be touching each other.
    • Added gdl::Font::LoadFontMem() function.
    • Added gdl::wii::ComponentCableUsed() function.
    • Added gdl::wii::SetNonInterlaced() function.
    • Added gdl::wii::LowResolutionMode global variable (true if system is running in low-resolution mode).
    • Added gdl::wii::Progressive global variable (true if system is running in progressive scan mode).
    • Added gdl::wii::Widescreen global variable (true if system is in widescreen).
    • Added gdl::DrawPoint() function.
    • Added a fix that makes lines draw properly in low-res mode but make sure you set the line width to 8 if you changed it.
    • Added optional extra parameter for gdl::Font::CalcStrLen() function.
    • Finally added real-time delta calculation so if you've paid attention to gdl::Delta, your program is now framerate independent. For best results, intensive routines must be placed between a gdl::PrepDisplay() and gdl::Display() pair for the delta value to be calculated properly.
    • Fixed some incorrectly defined color define values.
    • Fixed minor memory leak bug in gdl::Image::LoadImage() and removed default handlers as specifying 0 in the format parameter conflicted with specifying gdl::I4 as the texture format.
    • Fixed a bug inside gdl::Texture::LoadTexture() where it won't close an opened file handle if it failed to load a texture file.

Release 2 (3-20-2015)

  • Added DirectQB font support through the new gdl::Font class.
  • Fixed some framework design issues.
  • Removed quite a lot of commented out dead code.
  • Fixed some typos in the documentation.
  • Removed gdl::ShowLogo() function (it was useless for the most part).
  • Wii library v0.52b changes:
    • Optimized image, sprite, and text drawing code a bit and removed gdl::wii::DefaultCol struct as it is no longer needed.
    • Low-resolution mode can now be in progressive scan mode (through render-to-texture techniques) mainly to fix 'input lag' due to HDTVs trying to deinterlace the low-resolution video.
    • Framebuffers are now cleared during initialization.
    • Tremor library now in source form.
    • Fixed possible playback bug in oggplayer library when playing mono OGG files (whoops!) as well as the very brief reverse stereo click bug when playing stereo OGG files.
    • Removed Gamecube compatibility, especially when there's hardly anyone doing homebrew on the Gamecube nowadays.
    • Organized library functions into several .cpp files.
    • gdl::Sound class now stores sound data in MEM2 (using valloc()/vfree() functions).
    • All graphics functions now use GX_ClearVtxDesc() when reconfiguring the vertex descriptor which helps make custom graphics programming less prone to crashes.
  • PC library v0.48b changes:
    • Code fixes to eliminate the 'missing braces' compiler warnings.
    • Framerate limiter now set automatically (fixes jitter issues on certain graphics cards and heavy CPU usage).
    • Optimized sprite and text drawing code.
    • Fixed a bug in gdl::SpriteSet class which didn't delete its VBOs when it gets deconstructed.
    • Fixed frame delta calculation issues when dragging the window while the game is running.

Release 1.1 (1-25-2015)

  • As of 1-31-2015, a minor makefile bug for libpng has been fixed (it didn't install pnglibconf.h).
  • Minor Wii library update (0.43b).
    • Made low-res mode more HDTV friendly by enabling interlace jitter when component cables are used (after having a debate with tueidj).
    • Removed useless *colTable parameter in gdl::Texture::ConvertRawImage().
  • Wii library documentation for gdl::Texture::ConvertRawImage() is now up-to-date (forgot about it in relese 1).
  • Corrected some entries in the Wii library documentation.

Release 1 (01-22-2015)

  • PC version of the library now included (there might still be some hiccups here and there as most of the development effort went to the Wii version of the library).
  • Sprite Mapper tool now included (it is kinda bloaty as it was recycled from an ill-fated game engine made with QB64 some 2 years ago).
  • Created and added dolexec forwarder library based on FIX94's loadMii forwarder (no example of it for now but its EXTREMELY easy to use, no joke... Not defined in the template makefile though but its easy to implement anyway).
  • Forgot to include bulb.ply for the wii/graphics/3dsample example... Silly me!
  • Added spritesets example (WARNING: features ponies).
  • Added a silly whack-a-cirra minigame example.
  • Added wii/graphics/mipmap example.
  • Added wii/graphics/tilemap example.
  • Added wii/graphics/displaylist example.
  • Wii library updated to v0.42b:
    • Added built-in power off/reset handling with fade-out (only effective during a gdl::PrepDisplay()/gdl::Display() loop). Pressing the reset button won't do a hot-reset (restarts the running application) but instead, brings you back to the Homebrew Channel. This can be overridden with SYS_SetResetCallback() and SYS_SetPowerCallback().
    • Added non-interlaced low resolution mode (320x240/432x240 on NTSC/MPAL/EURGB60, 320x264/432x264 on PAL) which will do great for retro styled games or emulators. Will always be recognized as 480i even with component cables.
    • Added gdl::Texture::LoadTexture() function supporting single texture TPL files... Mipmapped textures are accepted but color-index textures and TPL files containing more than 1 texture are not supported.
    • Added TPL texture file support in gdl::Image::LoadImage()... Filter mode and texture format parameters specified to the function are ignored when loading TPL files.
    • Added I4, I8, IA4, and IA8 texture format support for the gdl::Texture and gdl::Image classes.
    • gdl::Texture::ConvertFromRaw() and gdl::Image::LoadImage() now uses MEM2 for storing temporary pixel data to help prevent malloc from jumping into MEM2 when loading lots of large images, can be reverted back to MEM1 allocation by specifying -DGDL_GC_COMPAT when compiling.
    • gdl::Image::LoadImage() now supports 8-bit palettized PNG images but it'll be converted into an RGB image upon loading.

Release 0 (01-01-2015)

  • Initial "New Year's Eve" release.