Den 2017-05-30 kl. 12:00, skrev Marco van de Voort:
For the 2Ders, in old GL I used glortho2d a lot. In newer ones I missed that, 
but I found
an equivalent on stackoverflow:

My FPC vector unit has overloading and many other functions (determinant, rotation around arbitrary axis...). Some functions like lookAt, frustum, ortho, matrix inverse etc are only in my C version so far. Not hard to port.

mat4 ortho(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat near, GLfloat far)
{
        float a = 2.0f / (right - left);
        float b = 2.0f / (top - bottom);
        float c = -2.0f / (far - near);

        float tx = - (right + left)/(right - left);
        float ty = - (top + bottom)/(top - bottom);
        float tz = - (far + near)/(far - near);

        mat4 o = SetMat4(
            a, 0, 0, tx,
            0, b, 0, ty,
            0, 0, c, tz,
            0, 0, 0, 1);
        return o;
}

So I have a pile of code on the topic, much of it for FPC. But shouldn't there really be a good OpenGL support package for FPC that was some kind of "standard"?

BTW, when I ported my OpenGL demos to FPC, I found that the FPC glext.pp had some fatal bugs. (Easy to fix, but I never figured out who would want the corrections, so I hope someone else noted that it crashed for modern OpenGL.)

/Ingemar

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to