User avatar
Zilla707
Posts: 73
Joined: Fri Aug 23, 2019 11:04 pm

OpenGL errors

Tue Nov 05, 2019 10:09 pm

Hello, I am trying to get OpenGL to work and have downloaded the zipped folder from https://github.com/stephanh42/rpigl and then unzipped the folder. Everything was fine until I ran the program and I got errors:
# Unzipping and building.

Code: Select all

pi@zillas-desktop-pi:~ $ cd ~/Downloads/
pi@zillas-desktop-pi:~/Downloads $ unzip rpigl-master.zip 
Archive:  rpigl-master.zip
6e546d961bb189b8b4c65317c1e9aa2b5cbd160e
   creating: rpigl-master/
  inflating: rpigl-master/.gitignore  
  inflating: rpigl-master/COPYING.txt  
  inflating: rpigl-master/README.md  
   creating: rpigl-master/demos/
  inflating: rpigl-master/demos/apple.png  
  inflating: rpigl-master/demos/bumpedspere.py  
  inflating: rpigl-master/demos/cubenormal.png  
  inflating: rpigl-master/demos/icosa.py  
  inflating: rpigl-master/demos/pygametest.py  
  inflating: rpigl-master/demos/simpletest.py  
  inflating: rpigl-master/demos/world_cube_net.png  
   creating: rpigl-master/rpigl/
  inflating: rpigl-master/rpigl/__init__.py  
  inflating: rpigl-master/rpigl/gles2.py  
  inflating: rpigl-master/rpigl/glesutils.py  
  inflating: rpigl-master/rpigl/lazycall.py  
  inflating: rpigl-master/rpigl/load_gles.py  
  inflating: rpigl-master/rpigl/rpi_egl.py  
  inflating: rpigl-master/rpigl/transforms.py  
  inflating: rpigl-master/setup.py   
   creating: rpigl-master/specfiles/
  inflating: rpigl-master/specfiles/README  
  inflating: rpigl-master/specfiles/enum.spec  
  inflating: rpigl-master/specfiles/gl.spec  
  inflating: rpigl-master/specfiles/gl.spec.FIXED  
  inflating: rpigl-master/specfiles/gl.tm  
  inflating: rpigl-master/specfiles/manpages.txt  
  inflating: rpigl-master/specfiles/manpages4.txt  
  inflating: rpigl-master/specfiles/readspec.py  
pi@zillas-desktop-pi:~/Downloads $ cd rpigl-master/
pi@zillas-desktop-pi:~/Downloads/rpigl-master $ python3 setup.py build
running build
running build_py
creating build
creating build/lib
creating build/lib/rpigl
copying rpigl/load_gles.py -> build/lib/rpigl
copying rpigl/lazycall.py -> build/lib/rpigl
copying rpigl/rpi_egl.py -> build/lib/rpigl
copying rpigl/gles2.py -> build/lib/rpigl
copying rpigl/glesutils.py -> build/lib/rpigl
copying rpigl/transforms.py -> build/lib/rpigl
copying rpigl/__init__.py -> build/lib/rpigl
pi@zillas-desktop-pi:~/Downloads/rpigl-master $ sudo python3 setup.py install
running install
running build
running build_py
running install_lib
running install_egg_info
Removing /usr/local/lib/python3.7/dist-packages/rpigl-1.0.egg-info
Writing /usr/local/lib/python3.7/dist-packages/rpigl-1.0.egg-info
pi@zillas-desktop-pi:~/Downloads/rpigl-master $ cd demos/
# Trying to run...

Code: Select all

pi@zillas-desktop-pi:~/Downloads/rpigl-master/demos $ python3 bumpedspere.py 
pygame 1.9.4.post1
Hello from the pygame community. https://www.pygame.org/contribute.html
libEGL warning: DRI2: failed to authenticate
Traceback (most recent call last):
  File "bumpedspere.py", line 153, in <module>
    MyWindow(640, 640, pygame.RESIZABLE).run()
  File "/usr/local/lib/python3.7/dist-packages/rpigl/glesutils.py", line 906, in __init__
    window = create_opengl_window(width, height, flags)
  File "/usr/local/lib/python3.7/dist-packages/rpigl/rpi_egl.py", line 233, in create_opengl_window
    window = rpi_create_window(2, attribList)
  File "/usr/local/lib/python3.7/dist-packages/rpigl/rpi_egl.py", line 197, in rpi_create_window
    window.create_EGL_context(gl_version, attrib_list)
  File "/usr/local/lib/python3.7/dist-packages/rpigl/rpi_egl.py", line 169, in create_EGL_context
    raise Exception("cannot create window surface")
Exception: cannot create window surface
Any help on this?
Aim for perfect and you'll hit somewhere near pretty good. (maybe...)
A quick wit is best followed by quick reflexes. (and a Band-Aid...)

User avatar
Gavinmc42
Posts: 4068
Joined: Wed Aug 28, 2013 3:31 am

Re: OpenGL errors

Wed Nov 06, 2019 12:49 am

Are you using a Pi4?
That old code won't work.

Try something newer?
https://github.com/tipam/pi3d
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
Zilla707
Posts: 73
Joined: Fri Aug 23, 2019 11:04 pm

Re: OpenGL errors

Wed Nov 06, 2019 10:55 pm

I am using a pi 3B+ and the newest version of noobs with Raspbian full installed.
Aim for perfect and you'll hit somewhere near pretty good. (maybe...)
A quick wit is best followed by quick reflexes. (and a Band-Aid...)

User avatar
Gavinmc42
Posts: 4068
Joined: Wed Aug 28, 2013 3:31 am

Re: OpenGL errors

Thu Nov 07, 2019 1:20 am

Lots of water under the bridge since rpigl was released.
But it's got shader code in it so could be fun to get working.

Could you be using the OpenGL driver for Raspbian on the Pi3?
Try switching to the other one, that's VC4 blob based.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
Zilla707
Posts: 73
Joined: Fri Aug 23, 2019 11:04 pm

Re: OpenGL errors

Thu Nov 07, 2019 10:50 pm

How would I do that? All the steps that I did are listed in my first post.
Aim for perfect and you'll hit somewhere near pretty good. (maybe...)
A quick wit is best followed by quick reflexes. (and a Band-Aid...)

User avatar
Gavinmc42
Posts: 4068
Joined: Wed Aug 28, 2013 3:31 am

Re: OpenGL errors

Fri Nov 08, 2019 1:07 am

Raspi-config has driver options.
I have not tried them on Pi3's, but I think the Pi3 can use the old and new drivers and Pi4 can only use the new one.
If that code is 6 years old then it was working only on old VC4 blob driver?

If you are using Buster it has both, Stretch only the old one.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
Gavinmc42
Posts: 4068
Joined: Wed Aug 28, 2013 3:31 am

Re: OpenGL errors

Fri Nov 08, 2019 11:37 am

Apart from the Pi3D stuff I have not used Python for OpenGL.
To check the libs are installed , this works.
https://pythonprogramming.net/opengl-ro ... -tutorial/

Second test
https://stackabuse.com/brief-introducti ... -pyopengl/

Something a bit harder
https://pythonprogramming.net/infinite- ... -tutorial/

So basic stuff is working, now back to those rpigl shader examples.

I have been using The Book of Shaders but that's not Python.

Back to Python - pyglet is now being installed, it has an interesting shader plugin.
https://pyglet.readthedocs.io/en/stable ... ing-pyglet

Pyglet looks like a modern OpenGL version of pygame.
Pygame was used in my first Pi gadget back in 2012, still running on a model A.

I use Gentoo64 so installing pyglet (emerge) takes much longer, TBC
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
Gavinmc42
Posts: 4068
Joined: Wed Aug 28, 2013 3:31 am

Re: OpenGL errors

Sat Nov 09, 2019 12:13 am

Pyglet, pyshaders, pyglbuffers, ratcave all look like interesting python stuff to play with.
But lots of the GLSL examples expect GL3.3

I don't think the rpigl examples will run on Pi4 it looks like it expects GLES.
In theory Pi4 is OpenGLES 3.0/3.1 that could go up to GLES 3.2.

Anyway, not much help in getting rpgl working
But I have to thank you for bringing Python to my attention re GLSL shaders.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
Zilla707
Posts: 73
Joined: Fri Aug 23, 2019 11:04 pm

Re: OpenGL errors

Sat Nov 09, 2019 1:00 am

OK, thanks for trying. I guess ill just stick to 2D graphics for now.
Aim for perfect and you'll hit somewhere near pretty good. (maybe...)
A quick wit is best followed by quick reflexes. (and a Band-Aid...)

User avatar
Gavinmc42
Posts: 4068
Joined: Wed Aug 28, 2013 3:31 am

Re: OpenGL errors

Sat Nov 09, 2019 1:16 am

Yippee, only a few changes to the minimal_setup.py needed to get it working
Raymarch worked too, but at 20fps
https://github.com/Blakkis/GLSL_Python
Raymarching in Python, who needs rpigl :D

Code: Select all

VERTEX_SHADER = """
#version 300 es
precision highp float;

Code: Select all

FRAGMENT_SHADER = """
#version 300 es
precision highp float;
Attachments
raymarch_py.png
raymarch_py.png (224.33 KiB) Viewed 593 times
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

Return to “Python”