Well I've searched google and the forums for an answer, but I didn't get an answer. In the MSDN/OpenGL Platform SDK Help I saw that it is multiplying the Projection Matrix with this one:

f = zFar
n = zNear
l = left
r = right
t = top
b = bottom
Ok, I've done so:
Code: Select all
Procedure glFrustum(Left.f, Right.f, Bottom.f, Top.f, Near.f, Far.f)
Dim Frustum_Matrix.f(4, 4)
Frustum_Matrix(0, 0) = (2.0 * Near)/(Right-Left)
Frustum_Matrix(1, 1) = (2.0 * Near)/(Top-Bottom)
Frustum_Matrix(2, 0) = (Right+Left)/(Right-Left)
Frustum_Matrix(2, 1) = (Top+Bottom)/(Top-Bottom)
Frustum_Matrix(2, 2) = -1 * ((Far+Near)/(Far-Near))
Frustum_Matrix(3, 2) = -1 * ((2.0*Far*Near)/(Far-Near))
Frustum_Matrix(2, 3) = -1.0
glMultMatrixf_(@Frustum_Matrix(0, 0))
EndProcedureCode: Select all
Procedure glFrustum(Left.f, Right.f, Bottom.f, Top.f, Near.f, Far.f)
Dim Frustum_Matrix.f(4, 4)
Frustum_Matrix(0, 0) = (2.0 * Near)/(Right-Left)
Frustum_Matrix(1, 1) = (2.0 * Near)/(Top-Bottom)
Frustum_Matrix(2, 0) = (Right+Left)/(Right-Left)
Frustum_Matrix(2, 1) = (Top+Bottom)/(Top-Bottom)
Frustum_Matrix(2, 2) = -1 * ((Far+Near)/(Far-Near))
Frustum_Matrix(3, 2) = -1 * ((2.0*Far*Near)/(Far-Near))
Frustum_Matrix(2, 3) = -1.0
glMultMatrixf_(@Frustum_Matrix(0, 0))
Text.s = "The matrix we calculated:"+#LF$
Text.s + "("+StrF(Frustum_Matrix(0, 0), 2)+", "+StrF(Frustum_Matrix(1, 0), 2)+", "+StrF(Frustum_Matrix(2, 0), 2)+", "+StrF(Frustum_Matrix(3, 0), 2)+")" + #LF$
Text.s + "("+StrF(Frustum_Matrix(0, 1), 2)+", "+StrF(Frustum_Matrix(1, 1), 2)+", "+StrF(Frustum_Matrix(2, 1), 2)+", "+StrF(Frustum_Matrix(3, 1), 2)+")" + #LF$
Text.s + "("+StrF(Frustum_Matrix(0, 2), 2)+", "+StrF(Frustum_Matrix(1, 2), 2)+", "+StrF(Frustum_Matrix(2, 2), 2)+", "+StrF(Frustum_Matrix(3, 2), 2)+")" + #LF$
Text.s + "("+StrF(Frustum_Matrix(0, 3), 2)+", "+StrF(Frustum_Matrix(1, 3), 2)+", "+StrF(Frustum_Matrix(2, 3), 2)+", "+StrF(Frustum_Matrix(3, 3), 2)+")" + #LF$ + #LF$
glGetFloatv_(#GL_PROJECTION_MATRIX, @Frustum_Matrix(0, 0))
Text.s + "The matrix multiplied with the current projection matrix:"+#LF$
Text.s + "("+StrF(Frustum_Matrix(0, 0), 2)+", "+StrF(Frustum_Matrix(1, 0), 2)+", "+StrF(Frustum_Matrix(2, 0), 2)+", "+StrF(Frustum_Matrix(3, 0), 2)+")" + #LF$
Text.s + "("+StrF(Frustum_Matrix(0, 1), 2)+", "+StrF(Frustum_Matrix(1, 1), 2)+", "+StrF(Frustum_Matrix(2, 1), 2)+", "+StrF(Frustum_Matrix(3, 1), 2)+")" + #LF$
Text.s + "("+StrF(Frustum_Matrix(0, 2), 2)+", "+StrF(Frustum_Matrix(1, 2), 2)+", "+StrF(Frustum_Matrix(2, 2), 2)+", "+StrF(Frustum_Matrix(3, 2), 2)+")" + #LF$
Text.s + "("+StrF(Frustum_Matrix(0, 3), 2)+", "+StrF(Frustum_Matrix(1, 3), 2)+", "+StrF(Frustum_Matrix(2, 3), 2)+", "+StrF(Frustum_Matrix(3, 3), 2)+")" + #LF$ + #LF$
glLoadIdentity_()
glFrustum__(Left, Right, Bottom, Top, Near, Far)
glGetFloatv_(#GL_PROJECTION_MATRIX, @Frustum_Matrix(0, 0))
Text.s + "The matrix we get from the real glFrustum:"+#LF$
Text.s + "("+StrF(Frustum_Matrix(0, 0), 2)+", "+StrF(Frustum_Matrix(1, 0), 2)+", "+StrF(Frustum_Matrix(2, 0), 2)+", "+StrF(Frustum_Matrix(3, 0), 2)+")" + #LF$
Text.s + "("+StrF(Frustum_Matrix(0, 1), 2)+", "+StrF(Frustum_Matrix(1, 1), 2)+", "+StrF(Frustum_Matrix(2, 1), 2)+", "+StrF(Frustum_Matrix(3, 1), 2)+")" + #LF$
Text.s + "("+StrF(Frustum_Matrix(0, 2), 2)+", "+StrF(Frustum_Matrix(1, 2), 2)+", "+StrF(Frustum_Matrix(2, 2), 2)+", "+StrF(Frustum_Matrix(3, 2), 2)+")" + #LF$
Text.s + "("+StrF(Frustum_Matrix(0, 3), 2)+", "+StrF(Frustum_Matrix(1, 3), 2)+", "+StrF(Frustum_Matrix(2, 3), 2)+", "+StrF(Frustum_Matrix(3, 3), 2)+")" + #LF$ + #LF$
MessageRequester("", Text)
EndProcedure[EDIT]
Problem fixed.
Correct code:
Code: Select all
Procedure glFrustum(Left.f, Right.f, Bottom.f, Top.f, Near.f, Far.f)
Dim Frustum_Matrix.f(3, 3)
Frustum_Matrix(0, 0) = (2.0 * Near)/(Right-Left)
Frustum_Matrix(1, 1) = (2.0 * Near)/(Top-Bottom)
Frustum_Matrix(2, 0) = (Right+Left)/(Right-Left)
Frustum_Matrix(2, 1) = (Top+Bottom)/(Top-Bottom)
Frustum_Matrix(2, 2) = -1.0 * ((Far+Near)/(Far-Near))
Frustum_Matrix(3, 2) = -1.0 * ((2.0*Far*Near)/(Far-Near))
Frustum_Matrix(2, 3) = -1.0
glMultMatrixf_(@Frustum_Matrix(0, 0))
EndProcedure
