Quote Originally Posted by Brainer
Finally, after weeks of struggling, the code works!

And here is a step-by-step guide:
1.First of all, I disposed of all my matrix code and rewrote it. Here are the functions you will need to compile the code: http://www.nopaste.pl/Source/mhc.txt
2.Use the following shaders: http://www.nopaste.pl/Source/mhd.txt
3.Your rendering code should look like this:
[code=delphi]
procedure TMainForm.RenderWorld;
var
Model, View, Proj, MVP: TBrainMatrix;
begin
// Clear the frame buffer
glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);

// Compute the model-view-projection matrix
Proj := Mat4CreatePerspective(60.0, ClientWidth / ClientHeight, 0.1, 1000.0);
Model := Mat4Translate(Mat4CreateRotationEuler(ModelRotatio n), Vec3Negate(ModelPosition));
View := Mat4Translate(Mat4CreateRotationEuler(CameraRotati on), Vec3Negate(CameraPosition));
View := Mat4Inverse(View);

MVP := Mat4Multiply(Model, Mat4Multiply(View, Proj));

// Update the shader
glUniformMatrix4fv(ShaderManager.ActiveProgram.Get UniformLocation('mvpmatrix'),
1, False, @MVP);

// Rendering code here...
end;
[/code]

I hope it saves someone almost two weeks of cursing.
Was my code helpful to you getting this working?

I hope so LOL

cheers,
Paul