PDA

View Full Version : My journey into OpenGL



Traveler
09-05-2003, 11:36 AM
Most of you know me from my DelphiX projects. In the past years I have made 4 large tutorials about the subject, 3 games and a few smaller demos.

But, although DelphiX is still loved by me (and many others I might add) I feel that I have to move on to something new.
For quite some time now, I'm trying to get as much info about opengl as possible. I have spent many, many hours searching the Net for tutorials, demos, components or otherwise opengl related websites.

At first I was quite pleased with the simplicity of it all. The first couple tutorials I tried from NeHe (http://nehe.gamedev.net) (not counting the setup tuts) seemed fairly easy. I made slight alterations, like scaling and moving objects, changing colors.
I already imagined myself writing the next Doom or Quake game. But I would soon realize that my journey so far had only been a few steps.

Placing a cube on the screen is all nice, but what about other, more complex forms? And what about colors, textures things like that. The ansers to the first part is of course a modeler.
And so I learned about Milkshape (http://www.swissquake.ch/chumbalum-soft/ms3d/), Anim8Or (http://www.anim8or.com/)and a couple others I have already forgotten about. But the few hours that I worked with these modelers made me realize that I already had a far more better tool: Lightwave.

The next problem was to get my object inside my program. I needed somesort of export/import tool. So, for days I worked on a tool that could do just that. The first result was, what is supposed to be a landscape with hills.
Despite the fact that it lacked lighting I thought it was pretty nice.
http://www.gameprogrammer.net/pics/outside/3dimg.jpg

A couple days later I came up with the idea of installing Delphi 7 which allowed me to have a look at GLXtreem. The demos of GLXtreem (http://www.glxtreem.xrs.net) looked awesome.
However, upon inserting my objects I noticed a slight difference. Mine weren't lit properly
http://www.gameprogrammer.net/pics/outside/3dimg.gif

The anwers to this problem lies in normals. Opengl wants to know the normal of a face(polygon) in order to calculate the lighting. So again, I went looking for ways to solve this puzzle.
(I believe I was at this point that I regretted that fact that I had not paid enough attention in math class, otherwise I would have known about stuff like crossproduct and normalizing. )

By the time I had included normalizing in my import tool. Screenshots were looking somewhat like this.
http://www.gameprogrammer.net/pics/outside/3dimg2.gif
Now that the lighting was working (sort of) I was also able to play with sliders to adjust color and rotation of the object.

I was quite pleased with the end result and I actually wanted to move on to texturing as I noticed that I just couldn't get the gl_smooth option enabled. And so again (thank god for Google) I turned to the Net.
Apparently next to face normals you also have those things called Vertex normals. Vertex normals are used if you want to use smooth shading (or Gouraud Shading).

After implementing this, my program now looks like this.
http://www.gameprogrammer.net/pics/outside/3dimg2.jpg
There are two lights here, both have different colors. Only one light is adjustable. Btw, at this point I nolonger use the GLXtreem toolkit, but a component called glWindow.

Well, this is about were I am now. Up until now it's been a lot of fun. I can truthfully say that I regret my decision not to have started with opengl earlier. I do however recommend, if you want to start the same journey, to either buy a good (red opengl)book and at least have access to Internet (and I do not mean with a modem)

Here (in no particular order) are some links I either found useful, interesting or worth mentioning:

http://isg.cs.tcd.ie/dingliaj/cs5/cs5_2003_lab8.html (gouraud shading)
http://www.flipcode.com/tutorials/
http://nehe.gamedev.net/
http://www.realtimerendering.com/
http://www.shaderx2.com/
http://student.cosy.sbg.ac.at/~maus/lod/sourcen/lokaleSeiten/Monstrous%20Software-Dateien/terrain.html
http://artsandtechnology.humber.ac.uk/~rcarter/tutorials/lesson11.pdf (pdf file)
http://www.codeguru.com/opengl/normals.shtml
http://www.cs.csustan.edu/~rsc/SDSU/Shading.Models.pdf (pfd file)
http://cs.mwsu.edu/~simpson/Graphics/slides/lecture11%5Bmyshading%5D.ppt (ppt file)
http://www.dcc.unicamp.br/~lmarcos/courses/mc603/redbook/ (opengl red book)
http://www.delphi3d.net/
http://nate.scuzzy.net/docs/normals/
http://www.opengl.org/
http://openglforums.com
http://www.sjbaker.org/steve/omniv/ten_shading_problems.html
http://www.sulaco.co.za/
http://amiga.student.utwente.nl/h.a.e.borger/projects/c_g/final/HuisjeVerslag.pdf(in dutch but with c++ code)
http://www.cfxweb.net/~delphigl/
http://www.gametutorials.com/
http://www.edm2.com/0603/opengl.html
http://vterrain.org/
http://koci.opengl.cz/angmuzika.htm
http://www.vampire-studios.tk/ (dutch website)
http://opengl.start4all.com/
http://www.exsanity.freeola.com/opengl.html
http://www.opengl.org/developers/faqs/beginner_faq.html
http://openglforums.com/tutorials/index.html
http://nate.scuzzy.net/
http://www.sgi.com/software/opengl/
http://glscene.sourceforge.net/index.php

Definitely to be continued....

Alimonster
09-05-2003, 12:58 PM
It's good to see that you're improving your skills. How do you find the time to do all this? I find it blooming difficult to get anything done after working all day :(.

Your lighting object thing looks great. :viking: