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

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s