I've never been a programmer it's just a hobby so this may be the reason why I don't know w lot of stuff. I'm currently trying to create my "own" platform layer on OS X. I previously used CoreGraphics to "blit" my bitmap to the screen. However to learn more and due to performance issues I started to use OpenGL for blitting.

I'm currently going through Casey's videos where he explains and describes OpenGL. But when I came to the point where he started to explain matrices (video 237), my brain shut down. I'm not that bad at math I guess. I'm studying mechanical engineering so I need to know a lot of math but I am used to use matrices in terms of FEM (Finite element method). When designing e.g. beams for whatever, mechanical engineers have to make sure that these are actually going to carry the weight they are loaded up with. So we use programs like Abaqus that slice the 3D models into "finite elements" and simulate stress with the rules of mechanics of materials.

Mechanics of materials makes heave use of matrices and mechanics theory itself copes a lot with linear equations which can be expressed through matrices which is a good form for computers to compute.

However in terms of OpenGL, drawing something it first gets translated into the unit cube and then stretched to the screen. And then there are matrix multiplications going on. This seems like a "round the edge" solution to me. Why not directly stretch it to the screen? Why first the unit cube and matrix multiplications which will lead to a result which is not wanted.

I would understand it if there were matrix multiplications if you wanted them to happen but they happen in the default way, which makes no sense to me as its unnecessarily complicating a task like drawing a bitmap to screen.

For an example:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | glViewport(0, 0, WindowDimension.Width, WindowDimension.Height); glClearColor(R, 0.0f, 1.0f, 0.0f); glClear(GL_COLOR_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glBegin(GL_TRIANGLES); glVertex2i(-1, -1); glVertex2i(1, -1); glVertex2i(1, 1); glVertex2i(-1, -1); glVertex2i(-1, 1); glVertex2i(1, 1); |

This code will draw two triangles to fill a rectangle. However you first have to disable some matrix multiplication and then use weird coordinates. To me it would make much more sense to pass actual coordinates to glVertex2i.

Moreover why matrix multiplications. I cant see the reason for multiplying a vector (consisting out of the points I'm passing in using glVertex2i) with a matrix.

Casey' said it's used for rotation and scaling and the 4rth value of a vector is used for displacement but it still doesn't make a lot sense to me.

To scale things up I could also multiply vectors by scalars right? Why use matrixes?

Of course you could also point me to online references.

Thank you.