Trash Talk - OpenGL Doc Flabby - Fri Dec 14, 2007 7:48 am Post subject: OpenGL
Anyone here have any real xperience in working with OpenGL (3D graphics) and could point me in the direction of some good tutorials, or post up a nice sample. I'm stuggeling to understand all these differnet matrices
Smong - Sun Dec 16, 2007 6:49 pm Post subject:
The classic tutorials are supposed to be here:
http://nehe.gamedev.net/default.asp
I've always wondered what the complete process was for getting a model from Blender into OpenGL but never really looked for such a tutorial. I think it would have to include vertex colors, normals and uv mapping for it to be useful.
grazzhoppa - Tue Dec 18, 2007 12:46 pm Post subject:
The "red book" is the programmer's guide to OpenGL. It's free too.
The goal of OpenGL is to turn a mathematical representation of a 3D world to a 2D dimensional display screen.
As a programmer, you create the 3D world by placing stuff in it with X, Y, Z coordinates.
OpenGL transforms those 3D coordinates to 2D coordinates on your computer screen via all those Matrices and matrix math.
You can place stuff at, say, (10, 0, 0) in the 3D world in two ways. One way is to actually place it at (10, 0, 0). Other way is to transform the "Model View" matrix in a way that adds 10 units to the x coordinate.
The Projection Matrix is what is used to transform your 3D coordinates even more to give the illusion of depth on a 2D screen (perspective - things get smaller the further they are away from the viewer). You can play with the Projection Matrix to change how OpenGL mangles your 3D coordinates to create illusions, (example: an "orthographic" projection matrix doesn't give perspective distortion)
NeHe's tutorials are most useful after you know how the basics of using an OpenGL implementation. I found NeHe's stuff useless when I was starting out. The "red book" explains OpenGL from the ground up which is much more useful - it's more theory than "copy-the-code" tutorials.
Gratuitous advice if you're working with Windows:
One thing to always remember about OpenGL is that the actual "library", from the view of a programmer that wants to use OpenGL in an app, is stuck at OpenGL 1.1. This early version has the bare basics for creating 3D scenes - no shaders, no flashy effects - the bare stuff.
How can OpenGL do modern 3D things then? The "library" is extended by individual companies - this means there is in fact many implementations of functions that OpenGL specifies.
OpenGL is a whitepaper that says "hardware is supposed to do this, you're supposed to access the hardware with a function that looks like this, now go and make it happen". Mostly companies, and sometimes open-source initiatives, go and make it happen.
How can a programmer get access to the modern OpenGL library? The computer running your OpenGL app must have the correct graphics drivers installed, the modern OpenGL library is in graphics drivers. You have to capture function-pointers to the modern OpenGL library functions during your app's run-time, as opposed to using a header file for compile-time library use.
I share this because it was something that took a while for me to understand. I couldn't figure out why there wasn't an SDK to download that had the OpenGL API that I could feed to the compiler.