OpenGL in C#

LangleyGL is a program that resulted when I ported my OpenGL code to C#. I had to learn C# in a hurry for a project at work, and thought this would be a good test. Of course, all of this was made possible by the csgl project. The basic purpose of the project to begin with was to load mesh files from a *.3ds format.Many thanks to the Wotsit file format page for the great info on the 3ds format.

Another reason for writing the program was to attempt to apply object oriented programming techniques in the realm of OpenGL. This turned out to be much more complicated than I had originally expected. Most computer scientists would point out that the 3D world is composed of many very obvious “objects” – Lights, meshes, cameras, etc. This is nice and all until you combine it with some type of state machine – Lights On/Off, Modelview/Projection, what’s my current texture, etc. I finally realized that I had to be aware of (almost) every function and parameter made available to me from the OpenGL API. The best resource I can recommend is the OpenGL Redbook. Read it cover to cover (even if some chapters don’t apply).

As it turned out, this program may be useful to basic computer graphics instructors. The parameters of the view matrix can be modified and the changes viewed in real time. It also includes limited lighting parameters and some material creation methods.

I’ve uploaded the auto-generated code comment report from Visual Studio.

Oh yeah, here’s the code.

Learning DirectX

Not much to say yet about this one. I just finished it on Friday, and I haven’t added any comments or anything else to explain what the code does. Just a cheesy game, but not bad for learning Direct3D in a week.

The point of the game is to collect as many CTIA logos as possible while dodging the snowballs. The more CTIA logos that are collected, the faster the snowballs roll. There is only one level, no high scores table, and tank doesn’t fire. Strangely enough – it was still entertaining enough to get me through a week of C# training.

Here’s a screen shot:

Screenshot of game.
┬áHere’s the code.