Common code

This page describes reusable code, not demos.

These files are needed for ALL demos! (Well, at least some parts are used over and over.) They are also the base of my lab materials in my courses. What I wanted to do here is a package that is transparent, easy to read and modify. No big do-everything packages spread over hundreds of files. Just a small number of to-the-point solutions of the most common problems.

This package includes:

MicroGlut, a single file GLUT replacement with the essentials and no old OpenGL dependencies, available for Linux, OSX and Windows.

VectorUtils3, a fairly capable vector/matrix package.

loadobj, a model loader that loads a subset of the Wavefront OBJ format. (Parts written by Mikael Kalms.) This file will be replaced by LittleObjLoader.c!

LittleOBJLoader, a model loader that loads a substantial subset of the Wavefront OBJ format. (Parts written by Mikael Kalms.) Replaces loadobj.c!

GL_Utilities, shader loader and more.

LoadTGA, loader for TGA images (simple lab-friendly image format). LoadTexture, below, is more capable, but LoadTGA will remain as a separate file for keeping the core core brief and understandable.


common.tar.gz (updated 2021-04-29, more updates in LittleOBJLoader

common.tar.xz (updated 2021-03-12, more updates in LittleOBJLoader New version of MicroGlut for Mac (2021-02-20)

common-feb-2021.tar.xz (updated 2021-02-19, updates in LittleOBJLoader and somewhat better Windows support)

common-jan-2021.tar.xz (updated 2021-01-25, replaces loadobj with LittleOBJLoader)

common-apr-2020.tar.gz (updated 2020-04-05)

common-apr-2019.tar.gz (updated 2019-04-16)

common-sep-2017.tar.gz (updated 2017-09-13)

common-170419.tar.gz (old version)

Additional files:

The following two files are enhanced versions of loadobj and LoadTGA, both written 2019.

Little OBJ loader is a largely rewritten new version of loadobj, simplified, easier to read, but most importantly much more capable than the old one! It can now load multi-part models with .mat files! I have tested it on a considerable number of OBJ files and it performs a lot better than loadobj, loading most models correctly complete with the .mat files.

LoadTexture is a simpler, but as far as I can tell also useful package, combining four image loaders so you can load PPM, TGA, PNG and JPG with one single call, with minimal dependencies.

These are the very first versions, so we should consider them preliminary at this time. They have, however, performed well in my tests so I believe they can be useful.

Links to pages with download links:

Little OBJ Loader


This page is maintained by Ingemar Ragnemalm.