Regal OpenGL wrapper

samuraicrow

Member
Joined
May 7, 2008
Messages
120
Age
45
Website
tech.groups.yahoo.com
Has anyone gotten http://github.com/p3/regal to work on any Linux platform? For the benefit of any who haven't heard of it, Regal is a wrapper of OpenGL ES 2 to get shader support for OpenGL desktop varieties. It's supposed to be like GLShim but for newer versions of OpenGL.

I suspect that the lack of GLX support is the culprit but I am unfamiliar with Linux drivers. I would be pleased to hear that it works.

If not, are there any other wrappers that would work on ARM Linux?
 

ptitSeb

Serial Porter
Joined
Aug 15, 2012
Messages
8,425
Age
46
Location
France, near Lyon
Has anyone gotten http://github.com/p3/regal to work on any Linux platform? For the benefit of any who haven't heard of it, Regal is a wrapper of OpenGL ES 2 to get shader support for OpenGL desktop varieties. It's supposed to be like GLShim but for newer versions of OpenGL.

I suspect that the lack of GLX support is the culprit but I am unfamiliar with Linux drivers. I would be pleased to hear that it works.

If not, are there any other wrappers that would work on ARM Linux?
<shameless plug>

Try gl4es, I have started implementing OpenGL 2.x support for GLES2, and it does support GLX (and it's already used on a few games).
</shameless plug>

My understanding was that, last time I checked regal (it was a long time ago admidetly), you need to rewrite your app to use regal, it wasn't a "drop'in" replacement to libGL.
 

ptitSeb

Serial Porter
Joined
Aug 15, 2012
Messages
8,425
Age
46
Location
France, near Lyon
Thanks! I'm looking forward to testing it with Warzone 2100 version 3.2!
Last time I tried, some shaders didn't convert correctly.
I think there are using multiple target per FBO, wich GLES 2.0 doesn't support (I think GLES 3.0 does), and I hadn't looked for a work around (it was for the fonts).
 

Silent-Hunter

Hardcore Member
Joined
May 29, 2010
Messages
3,069
I'm wondering if gl4es or Regal will allow Stardew Valley to be played on OpenPandora or Pyra. I tried to run it, and all that seemed to be missing was OpenGL 2.0 support.
 

samuraicrow

Member
Joined
May 7, 2008
Messages
120
Age
45
Website
tech.groups.yahoo.com
I downloaded and built the trunk code on my ODroid XU4 but there's no target in the resulting make file for a "sudo make install". Where do I copy the libGL.so.1 file to? I tried putting it in /usr/lib/ and made a link called libGL.so but it's still using the unaccelerated framebuffer under Ubuntu.
 

ptitSeb

Serial Porter
Joined
Aug 15, 2012
Messages
8,425
Age
46
Location
France, near Lyon
I downloaded and built the trunk code on my ODroid XU4 but there's no target in the resulting make file for a "sudo make install". Where do I copy the libGL.so.1 file to? I tried putting it in /usr/lib/ and made a link called libGL.so but it's still using the unaccelerated framebuffer under Ubuntu.
You don't have to install install-it system wide. Simply use the export LD_LIBRARY_PATH=/PATH/TO/LIBGL:$LD_LIBRARY_PATH to have the lib accessible.
(but if you really want to copy it, yes /usr/lib or /usr/lib/arm-something should work).

*EDIT* How do you know it's not Hardware accelerated btw?
 

rohezal

Advanced Member
Joined
Oct 18, 2009
Messages
1,673
You can check what libs a binary uses via ldd binary_name:

Code:
ldd /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
    linux-vdso.so.1 =>  (0x00007ffcaebe6000)
    libgdk-3.so.0 => /usr/lib/x86_64-linux-gnu/libgdk-3.so.0 (0x00007fdcd31a8000)
    libgmodule-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgmodule-2.0.so.0 (0x00007fdcd2fa4000)
    libpangocairo-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libpangocairo-1.0.so.0 (0x00007fdcd2d97000)
    libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007fdcd2a5d000)
...
 

samuraicrow

Member
Joined
May 7, 2008
Messages
120
Age
45
Website
tech.groups.yahoo.com
When I run Warzone 2100 it's a slideshow in tutorial mode and is almost unresponsive. Also, the default GLX driver is unaccelerated on desktop Mesa even though there is a good OpenGL ES 3 capable GPU as described by the Hardkernel documentation.

Edit: glxinfo gives slow or none for every screenmode also.
 

ptitSeb

Serial Porter
Joined
Aug 15, 2012
Messages
8,425
Age
46
Location
France, near Lyon
For gl4es, you also need to "activate" the GLES2 backend (it's the GLES1.1 by default for now). Use the export LIBGL_ES=2 for that (that will also activate emulation of OpenGL 2.0. use LIBGL_GL=21 to have OpenGL 2.1, but that wont really change the emulation itslef, just the version of OpenGL emulated).
 

samuraicrow

Member
Joined
May 7, 2008
Messages
120
Age
45
Website
tech.groups.yahoo.com
Updates: When I try Warzone 3.2 I get a black screen on the ODroid. Maybe it's using some function that isn't present on GL4ES.

I got 3.1 working on my RasPi 2 using the experimental OpenGL driver but it's a little unstable and the audio messes up due to the graphics driver bugs. (I know it's not Warzone because other audio apps have problems as well.) Since 3.1 had the option to run without shaders, I've heard even GLShim could get it working on the RasPi so that shouldn't be big news except that it was running at a higher framerate than the framebuffer on the ODroid.
 

ptitSeb

Serial Porter
Joined
Aug 15, 2012
Messages
8,425
Age
46
Location
France, near Lyon
@samuraicrow : I have just tried latest warzone 2100 from git on a VM (not the best environment for testing, but I have only that right now,but Mesa GLES2 is enough for quick testing).

At first, warzone didn't want to start because it didn't get double buffered context. So I faked that (you need to get latest gl4es source with commit
da78eb4a81752eefb276ec48da707a05cfd5b5bb).
Now Warzone do works on my VM using gl4es. There are some mipmap issue, so be sure to use those 2 exports:
Code:
export LIBGL_ES=2
export LIBGL_MIPMAP=3
and with that, it seems to works fine. I'll try on a Pandora tonight see how it works on actual GLES2 hardware.

*EDIT* Also, I see that the multiple attachement issue I talked about earlier is removed for now in the shaders (look in spoiler for source of the shader)
Code:
uniform vec4 color;
uniform sampler2D texture;

varying vec2 uv;

void main()
{
    vec4 texColour = texture2D(texture, uv) * color.a;
    gl_FragColor = texColour * color;

    // gl_FragData[1] apparently fails to compile for some people, see #4584.
    // GL::SC(Error:High) : 0:12(2): error: array index must be < 1
    //gl_FragData[0] = texColour * color;
    //gl_FragData[1] = texColour;
}
 
Last edited:

ptitSeb

Serial Porter
Joined
Aug 15, 2012
Messages
8,425
Age
46
Location
France, near Lyon
I confirm that latest WarZone 2100 is working nicely with latest gl4es using GLES2 backend.

Here is a screenshot of it running on the Pandora.
warzone_03.png


It's working with shadows (as you can see).

With default sources, there is a bit a z-fighting on the Pandora. So I changed the line 1090 of src/terrain.cpp from
Code:
glPolygonOffset(0.1f, 1.0f);
to

Code:
glPolygonOffset(1.0f, 1.0f);
And it's now working perfectly.
Speedwise, I'm around 9~10 fps on my gigahertz with no special attempt to optimize, so not bad (I can move from vorbisfile to tremor for example).
 

samuraicrow

Member
Joined
May 7, 2008
Messages
120
Age
45
Website
tech.groups.yahoo.com
The Z-fighting is not gone. I get no text on the menu on my ODroid.

Edit: The error printed on the console indicates an array subscript too big in a fragment shader. Maybe that's the problem.
 
Last edited:

ptitSeb

Serial Porter
Joined
Aug 15, 2012
Messages
8,425
Age
46
Location
France, near Lyon
The Z-fighting is not gone. I get no text on the menu on my ODroid.
Edit: The error printed on the console indicates an array subscript too big in a fragment shader. Maybe that's the problem.
Yep. You need to update your Warzone version. There was a shader, at some point, that use gl_Data[1] which is not supported on GLES, and , apparantly, on some Desktop OpenGL hardware has it has been remove in latest version.
 

samuraicrow

Member
Joined
May 7, 2008
Messages
120
Age
45
Website
tech.groups.yahoo.com
Yep. You need to update your Warzone version. There was a shader, at some point, that use gl_Data[1] which is not supported on GLES, and , apparantly, on some Desktop OpenGL hardware has it has been remove in latest version.
Hmmmm... The git top of tree requires a newer version of Qt than what Debian Jessie comes with. I guess I'll have to try Debian Stretch in release candidate form.
 
Top