[fpc-pascal] GLM library alternative?

Anthony Walter sysrpl at gmail.com
Mon May 29 20:07:40 CEST 2017


Thanks for posting those LookAt and Perspective routines. They're kind of
needed with OpenGL ES 2.0, as it no longer has matrix modes. You need to
build your own perspective and model view matrices and pass them to your
vertex shaders as uniforms.

uniform mat4 modelview; // modelview matrix uniform
uniform mat4 projection; // projection matrix uniform

attribute vec3 xyz; // vertex position attribute
attribute vec2 uv; // uv texture coordinate attribute

varying vec2 texcoord; // varying texture coordinate

void main()
{
    vec4 vertex = modelview * vec4(xyz, 1.0); // transform vertex with
modelview matrix uniform
    gl_Position = projection * vertex; // project the transformed vertex
and write it to gl_Position
    texcoord = uv; // assign the uv texture coordinate to the varying
}

By the way, what's stopping you guys from using OpenGL ES 2.0? It works on
most all Windows, Mac, and Linux systems, and it's the only 3D graphics API
on Raspberry Pi and most smart phones/tablets.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20170529/d3523fc7/attachment.html>


More information about the fpc-pascal mailing list