PINE64
How to use GLFW / OpenGL ES on Armbian - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: ROCK64 (https://forum.pine64.org/forumdisplay.php?fid=85)
+--- Forum: Linux on Rock64 (https://forum.pine64.org/forumdisplay.php?fid=88)
+--- Thread: How to use GLFW / OpenGL ES on Armbian (/showthread.php?tid=7393)



How to use GLFW / OpenGL ES on Armbian - flyx86 - 04-17-2019

Hi folks,

I am trying to write a small application that renders stuff using OpenGL ES on Armbian. I enabled 3D video acceleration via the RK3328 Media Script. Now I'm trying to create a simple window with an OpenGL context on it, using GLFW:


Code:
if err := glfw.Init(); err != nil {
 panic(err)
}
defer glfw.Terminate()

glfw.WindowHint(glfw.ClientAPI, glfw.OpenGLESAPI)

window, err := glfw.CreateWindow(640, 480, "Testing", nil, nil)

(This is Go, but I think the programming language is not really relevant.)

I compile and link that using -lGLESv2 and GLFW's dependencies, which produces a binary. However, when I execute that, I get:

Code:
libGL error: unable to load driver: rockchip_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: rockchip
2019/04/14 16:46:56 Link error in program Program(0): ""

So for some reason, my executable uses libGL instead of libGLESv2, and that doesn't work, since the rockchip only supports OpenGL ES. I have no idea why that happens. ldd ensures me that my binary is not linked against libGL.

How can I fix that? Is there perhaps a better Linux distribution for development? I tested Debian before, but that wasn't even able to install X11 and was pretty bricked after I tried.


RE: How to use GLFW / OpenGL ES on Armbian - ab1jx - 11-24-2019

For whatever it's worth glxgears tells me the same thing.
Code:
libGL error: unable to load driver: rockchip_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: rockchip

And es2gears:
Code:
libEGL warning: DRI2: failed to open rockchip (search paths /usr/lib/aarch64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri)

But in my xorg log
Code:
[   727.608] (II) Loading sub module "dri2"
[   727.608] (II) LoadModule: "dri2"
[   727.608] (II) Module "dri2" already built-in

In the README with armsoc (xorg video driver, this from Ayufan at
https://github.com/ayufan-rock64-packages/xf86-video-armsoc
it talks about building a DRM driver yourself and there is a drmmode_rockchip.c which compiles by the makefile into drmmode_rockchip.lo
So I copied that to one of the paths mentioned and ran ldconfig but it didn't seem to make any difference.  (DRM and DRI are different versions of the same thing).  Oh, wait a normal library is a .so file, I think a .lo is only for linking to something else.

I remember there was an ad that touted the Rock64 as a multimedia powerhouse and I think I remember 500-600 FPS from es2gears or glxgears.  I also remember fullscreen video without CPU load.   But now I'm seeing 200-300 with a lot of CPU usage so the Mali isn't doing anything.  When in doubt, reboot, so I'll try that.

I installed glmark2 (benchmark) from https://github.com/glmark2/glmark2 and it tells me:
Code:
   OpenGL Information
    GL_VENDOR:     VMware, Inc.
    GL_RENDERER:   llvmpipe (LLVM 7.0, 128 bits)
    GL_VERSION:    OpenGL ES 3.0 Mesa 18.3.6
so it's running under Mesa as I suspected.  I don't know how to switch.  But I'm running an Ayufan image not Armbian.  You can run Mesa on pretty much anything I think, it's software emulation, it's not the Mali.

Try glxinfo too, what I see at the top is
Code:
libGL error: unable to load driver: rockchip_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: rockchip
then it proceeds to exercise Mesa and show lots of data about it.  But it confirms that it's not hardware OpenGL ES.