Hello.

I've been struggling with this problem for about two weeks now and was unable to find a solution. This is my first attempt at OpenGL 3.x programming, so I may be doing something wrong.

I'm trying to make a simple spinning triangle demo with a camera the user can move and use the mouse to look around the world. Here's how the triangle is created:
[code=delphi]
procedure TMainForm.InitializeOpenGL;
var
Vert: array[0..8] of Single;
begin
{ ... }
Vert[0] := -0.3;
Vert[1] := 0.5;
Vert[2] := -1.0;
Vert[3] := -0.8;
Vert[4] := -0.5;
Vert[5] := -1.0;
Vert[6] := 0.2;
Vert[7] := -0.5;
Vert[8] := -1.0;

TriangleRot := 0.0;

glGenVertexArrays(1, @TriangleVAO);
glBindVertexArray(TriangleVAO);
glGenBuffers(1, @TriangleVBO);
glBindBuffer(GL_ARRAY_BUFFER, TriangleVBO);
glBufferData(GL_ARRAY_BUFFER, 9 * SizeOf(Single), @Vert, GL_STATIC_DRAW);
glVertexAttribPointer(0, 3, GL_FLOAT, False, 0, nil);
glEnableVertexAttribArray(0);
glBindVertexArray(0);
end;
[/code]

And now here's the Render procedure which renders my scene:
[code=delphi]
var
ProjMat, Cam, ModelView: TMatrix;
begin
glViewport(0, 0, ClientWidth, ClientHeight);
glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);

// Projection update
if (ClientHeight <= 0) then
ClientHeight := 1;
ProjMat := MatrixProjection(40.0, ClientWidth / ClientHeight, 0.1, 1000.0);
glUniformMatrix4fv(glGetUniformLocation(ShaderMana ger.GLSLPrograms['minimal'].
ProgramHandle, 'projectionMatrix'), 1, ByteBool(GL_FALSE), @ProjMat);

// Camera transformations
Cam := MatrixTransform(VectorNegate(Camera.Pos), VectorUniform(0.0),
VectorUniform(1.0));
ModelView := MatrixTransform(VectorUniform(0.0), VectorCreate(0.0, TriangleRot, 0.0), VectorUniform(1.0));
ModelView := MatrixMultiply(ModelView, Cam);
glUniformMatrix4fv(glGetUniformLocation(ShaderMana ger.GLSLPrograms['minimal'].
ProgramHandle, 'modelViewMatrix'), 1, ByteBool(GL_FALSE), @ModelView);

glBindVertexArray(TriangleVAO);
glDrawArrays(GL_TRIANGLES, 0, 3);
glBindVertexArray(0);
end;
[/code]

Here's what gets rendered: http://www.youtube.com/watch?v=o9LDivwjUx0

But instead, I'd like the triangle to spin around itself. JSoftware provided me with a vector that indicates the center of rotation of the triangle. So, using it here:
[code=delphi]
ModelView := MatrixTransform(VectorCreate(0.3, 5.0 / 3.0, 1.0),
VectorCreate(0.0, TriangleRot, 0.0), VectorUniform(1.0));
ModelView := MatrixMultiply(ModelView, Cam);
[/code]
I get: http://www.youtube.com/watch?v=aQleDlo5li8

Everything is OK, but the object is not placed at (0,0,0), which is the point I want it to be put at.

How do I change the code so that it spins around itself and stays at (0,0,0)?

If you blame my matrix code, here's the whole unit: http://www.nopaste.pl/Source/m6s.txt