Page 1 of 1

OpenGL errors

Posted: Tue Nov 05, 2019 10:09 pm
by Zilla707
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?

Re: OpenGL errors

Posted: Wed Nov 06, 2019 12:49 am
by Gavinmc42
Are you using a Pi4?
That old code won't work.

Try something newer?
https://github.com/tipam/pi3d

Re: OpenGL errors

Posted: Wed Nov 06, 2019 10:55 pm
by Zilla707
I am using a pi 3B+ and the newest version of noobs with Raspbian full installed.

Re: OpenGL errors

Posted: Thu Nov 07, 2019 1:20 am
by Gavinmc42
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.

Re: OpenGL errors

Posted: Thu Nov 07, 2019 10:50 pm
by Zilla707
How would I do that? All the steps that I did are listed in my first post.

Re: OpenGL errors

Posted: Fri Nov 08, 2019 1:07 am
by Gavinmc42
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.

Re: OpenGL errors

Posted: Fri Nov 08, 2019 11:37 am
by Gavinmc42
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

Re: OpenGL errors

Posted: Sat Nov 09, 2019 12:13 am
by Gavinmc42
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.

Re: OpenGL errors

Posted: Sat Nov 09, 2019 1:00 am
by Zilla707
OK, thanks for trying. I guess ill just stick to 2D graphics for now.

Re: OpenGL errors

Posted: Sat Nov 09, 2019 1:16 am
by Gavinmc42
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;