NOTE: For the HTML version of this article with graphics and downloads please visit the following link:
I have always been interested in computer graphics and their applications. Data representation and visualization is one of the main areas of HCI (Human Computer Interaction), and the better you make the interaction between a machine and a human, the more productivity will be generated by both the human and the machine. I had some experience with OpenGL during my undergraduate studies while attending the California Polytechnic University. Unfortunately, I never got a chance to pursue the more advanced features of the OpenGL library, given my time and work responsibilities.
You can find more about OpenGL at http://www.opengl.org . There are also a bunch of good literature available on the topic of Computer Graphics and OpenGL that you can refer for further advances. Please check the Background / Reference section for a list of some reference material that I have used, in general, for computer graphics.
The following project is a very simple example demonstrating how to generate a terrain based on a bitmap file. The objective of the project is to generate a three dimensional terrain based on some data file. Please note, that this could have been any data file, but for the purpose of our example, we are going to be using a 32×32 dimensional bitmap file. We could have easily used a text file, and defined logic for each word or letter to represent it graphically.
The project also contains a good Windows framework that can be used for your other OpenGL applications. The current project allows you to rotate the camera using your mouse.
Once again, this is a simple approach to terrain generation, which can be a very difficult task in complex environments.
Background / Reference
Since Computer Graphics is kind of an advanced topic, it is necessary to have at least some king of understanding and exposure to the concepts and theories in the field. However, this does not mean that you will not be able to use the following code or understand it. I have made it as simple as possible, and hopefully, it will give you a good start, or some additional source of information that you can use for your projects. Also, please note that you will need to have a good understanding of C / C ++ programming.
Some books I have used for learning Computer Graphics and OpenGL programming:
Books I used while attending the California Polytechnic University:
OpenGL Programming Guide, or better know as the Red Book.
Computer Graphics Using OpenGL, 2nd Edition.
Books I used while attending the California Lutheran University:
OpenGL: A Premier, 2nd Edition.
Interactive Computer Graphics: A Top-Down Approach Using OpenGL, 4th Edition.
What is a Terrain?
Some background information on a terrain and their uses in a game application: A terrain in an environment is one of the most critical components in the scene that is being rendered. It could easily be the …