Home arrow OpenGL Project
Erick Duchesneau | Sunday, 17 December 2006
Main Menu
Home
FAQs
My Web Links
Contact Me
- - - - - - -
Who am I?
OpenGL Project
Ottawa Engineers.ca
 
 
 
OpenGL Project PDF Print E-mail
Written by Administrator   
Thursday, 11 March 2004

I have just started recently working with OpenGL with my friend Jim. As we work with it we plan to keep adding screenshots,code,and notes here. If you you find it useful then please feel free to use it.

Oh. Jim, is also keeping a web page dedicated to this project, his should be more up to date then mine since I just take the screen shots and the code off his site. You can link to his site here, or find the link in my Web Links.

Code Snap Shot 1: A Example Of Picking

This is our first attempt at writing OpenGL. Jim got a cold a few weeks back and was terribly bored so we decided to start working on our OpenGL project. The list of features right now is pretty limited but here it is for now:

  • Simple classes created as builing blocks for writing a real application: cube, wirecube, sphere, person, and ground
  • Model (not view) is rotated with arrow keys.
  • Can zoom/scale in/out with "+" and "-" keys on the number keypad.
  • Objects on the ground (cube,sphere,person) can be selected with left mouse click and highlighted with a green wirecube

Here is the our source code:

Below is two screen shots of how picking works right now when selecting either a 'cube' or 'person' on the 'ground'.

Code Snap Shot 2: Moving Picked Objects

Here is a small update of my previous code except we can now select an object and press the 'm' key. We can then click any where and have the object transport (without animation) to that location. Here is the feature list:

  • Same features as above previous code snap shot
  • Select an object ... press 'm' ... click the mouse ... the object will move to where on the 3D model you clicked the mouse.
  • To get out of "move mode" on a slected object press any key other than the arrow keys,'z','+','-',space or 'm'

Here is the our source code:

When the program starts 12 cubes, 12 spheres, 12 people are placed randomly at locations on the flat white plane. This was Jim's idea, and well I must say its a really good idea. The below screen shots show the results of being able to move all the objects one at a time to a determined using the mouse. Now we just got to add some animation to this movement instead of the teleport :P.

Code Snap Shot 3: Fog and shinny sphere's

Here is a another small update of our previous code with fog added. Here is the feature list:

  • Same features as above previous code snap shot
  • Sphere's are now shinny and reflect light. For some reason cubes don't seem to have the right same type of reflective properties as the sphere's ... We'll come back and look at this ...
  • Now there is a fog added to the view ... it looks pretty cool for something so easy to add ...

Here is the our source code:

Here's a simple picture showing the fog:

Code Snap Shot 4: Textures

We added textured cubes for fun ... so here's an update with more code and another screen shot.

  • Same features as above previous code snap shot
  • Added textured cube object

Here is the our source code:

Here's a simple picture showing the wood textured cube:

Code Snap Shot 5: Terrain

We added some height mapped ground ... this looks very cool for a relatively simple change:-)

This was done by starting with some tutorial code on the nehe www site tutorials (lesson 34).

  • Same features as above previous code snap shot
  • Added ground height mapping:
    • Objects on ground are still mapped to surface.
    • Selection is still working for these objects.
    • Camera view now always points at the middle of the ground.
    • Roatation of model occurs around camera view point.

Here is the our source code:

Here's two pictures of the height mapped ground:

Last Updated ( Wednesday, 17 March 2004 )
 
   
     

 
 

Mambo is Free Software released under the GNU/GPL License.