OpenGL / openFrameworks Terrain Loader Update

Just a quick update on what I have been working on. One of the first posts on this blog was a terrain viewer. That project was thrown together very quickly for a weekly assessment, so it wasn’t coded very well and was exceptionally bloated for what it did. I have had some spare time, so I started a fresh and commenced building a minimal terrain loader from the ground up. So far, I have terrain loading from file (generated with the tool in previous posts), and displaying a texture mapped, shadowed terrain using glDrawElements. I have specifically not included loading from heightmap in this project because it is easier to load a point struct from a binary file, but heightmap loading could be added in easily and probably will be in the coming days / weeks.

The code is written using OpenGL and the openFrameworks toolkit. OpenFrameworks is used for loading the textures and setting up a window, etc. The size of the file is surprisingly small, just a few hundred lines. I thought I would upload this before I changed everything to a class and added some level of detail stuff to it. So here is a picture showing the pretty terrain.

Textured 512x512 shadowed terrain

I have heaps more work to do on this subject, but for now here is the source code.
Just drop this into your openFrameworks project (or use with openGL and load your own images).
The zip file also contains the terrain and the texture.

Download Link

Terrain Loader – Heightmap

This program is an older OpenGL based terrain loader. The program loads in a greyscale heightmap and generates the terrain based on height values stored in the image. This version uses the DevIL image library which allows it to load a wide variety of file formats. Several textures are loaded, these include the ground texture, the detail texture and the water texture. A simple method of creating a water plane is to create a plane at a certain level for example a y axis height of -10, then animate the UV coordinates of the plane so that the water appears to move.

The detail texture allows the ground to have far more “detail” than normal. Usually a detail texture is a perlin noise or similar that is blended with the ground texture. Below is the image of a loaded heightmap.

Post3terrainpic

I was going to post the source code to this example, but the code uses a triangle list method without any level of detail, so once I get the time to update this program and change the display method to a vertex buffer and add some other features I will post the code for other people to learn from.

Doom md5 Model Loader

This code will load a doom md5 model with textures and animation. The source code for this application was adapted from here. I do have a better version of this application but some of the features are not yet complete such as bump mapping and displacement mapping. I will upload the updated version at some point in the future when I have enough spare time to finish it.

Some interesting additional information about the doom md5 model format is available at the following websites:

http://www.doom3world.org/phpbb2/viewtopic.php?t=2884
http://www.modwiki.net/wiki/MD5MESH_(file_format)

Here is a pretty screenshot from the program:

 

The pinky doom md5 model

The pinky doom md5 model

 

Download link

(Note: Files are in RAR file format and projects are created in Visual Studio 2005)
Let me know if any of the links go dead 🙂

First Blog – Empty Project

My name is Daniel Beard and I am a third year games programming student. I wanted a place to upload work that I have done and build a profile over time. Hopefully someone else will get some use or education from my programs.

The first post is something nice and simple. A simple empty glut project. The amount of times that I have set up a new project completely is ridiculous. It is always good to have a solid base to build from so here is an empty glut project with a rotating cube.

This example project is just a glut project with a simple spinning cube. Some of these projects may not have ideal code in some parts of them, but as I think of better ways to do things they will be updated.

Spinning Cube

Spinning Cube

Here is the link to the project – download

(Note: Files are in a RAR folder and created in Visual Studio 2005)
Let me know if any links go dead 🙂