Matrix differences with OpenGLES on linux

I am porting some of my OpenGLES based apps from Android to Linux Mint 22.3 but its seems like linmath implements things differently. I am thankful you have a couple OpenGLES examples that run, but the triangle is lost when the frustum is setup for 3D perspective the following way. The code below shows how it is setup on the PICO platform that was closely derived from the discontinued Daydream platform (which is mentioned in the linmath comments). Even if I had the source code of Daydream or PICO matrix functions I would not know how to compare them to the linmath ones:

    float eyeX = 0.0f;
    float eyeY = 0.0f;
    float eyeZ = -0.0f; // Was -0.5f;
    float lookX = 0.0f;
    float lookY = 0.0f;
    float lookZ = -1.0f; // Was -5.0f;
    float upX = 0.0f;
    float upY = 1.0f;
    float upZ = 0.0f;

    // For using with linmath:
    vec3 eye;
    eye[0] = eyeX;
    eye[1] = eyeY;
    eye[2] = eyeZ;
    vec3 look;
    look[0] = lookX;
    look[1] = lookY;
    look[2] = lookZ;
    vec3 up;
    up[0] = upX;
    up[1] = upY;
    up[2] = upZ;

    mat4x4_look_at(mViewMatrix, eye,look,up);

    float ratio = (float)(width) / (float)(height);
    float left = -ratio;
    float right = ratio;
    float bottom = -1.0f;
    float top = 1.0f;
    float near = 1.0f; // Was 4.0f for DayDream
    float far = 6000.0f; // 30000.0f for the moon.

    mat4x4_frustum(mProjectionMatrix, left,right, bottom,top, near,far);

Hi Jan,

This forum is primarily for GLFW help. I don’t use linmath.h myself but you could potentially get help via their repository on Github: GitHub - datenwolf/linmath.h: a lean linear math library, aimed at graphics programming. Supports vec3, vec4, mat4x4 and quaternions · GitHub

Oh, thanks for that link. Issue 55 says it all. It implemented mat4x4’s in a different way than usual:

It could be salvaged if there was a minimal example of how to set things up in a similar manner to the way gluPerspective used to do it, perhaps with a rotating cube. Its not important if cubes rotate in the wrong direction. Their angles could always be inverted easy.

GLFW only used linmath for examples of GLFW, we don’t intend to add tutorials or examples of how to use linmath nor how to convert from GLU code, especially as GLU has been deprecated for some time now.

I’ve been looking for any 3D examples using OpenGL ES on GLFW but have not found any. Its strange then that all the 3D examples that you do have are using the old OpenGL and not OpenGL ES. I really wonder what linear math libraries people are using to do 3D with OpenGL ES on GLFW. I cannot imagine that everyone is making their own linear math functions…

You don’t need to look for “3D examples using OpenGL ES on GLFW” since GLFW is only involved with the windowing side, not the 3D side.

The math used in most OpenGL examples will be able to be used with the OpenGL ES API as they share the same same rules.