Hoche96
Posts: 10
Joined: Wed Jan 28, 2015 6:54 pm

Python with OpenGLES

Wed Jan 28, 2015 7:13 pm

Hello everybody,

I searched the whole internet for tutorials of Python with OpenGLES but I can't even find simple examples. Do I really must use low-level languages like C or C++ for graphic programming with OpenGLES? My problem is that I can't use for example the C code to translate it to Python, my C skills are to low. Also I used PyQt5 and looked into the opengl examples but it doesn't worked great on the pi. Any suggestions?

My project:
I want to make something like in the video with my raspi and now I wanted to make the sonar program. Some tips would be great. https://www.youtube.com/watch?v=rh6UxpzHlJI

Best regards Hoche96

User avatar
PeterO
Posts: 4246
Joined: Sun Jul 22, 2012 4:14 pm

Re: Python with OpenGLES

Wed Jan 28, 2015 8:10 pm

I think you want pi3d, but I've not used it myself.....

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),Aeromodelling,1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

Hoche96
Posts: 10
Joined: Wed Jan 28, 2015 6:54 pm

Re: Python with OpenGLES

Wed Jan 28, 2015 8:26 pm

Thanks for this but I wanted to explicit use OpenGL. I think I really should start with C. For raspi with C and OpenGLES 2 I find a lot tutorials.

User avatar
PeterO
Posts: 4246
Joined: Sun Jul 22, 2012 4:14 pm

Re: Python with OpenGLES

Wed Jan 28, 2015 8:44 pm

Is https://github.com/stephanh42/rpigl any better for you ?

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),Aeromodelling,1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

Hoche96
Posts: 10
Joined: Wed Jan 28, 2015 6:54 pm

Re: Python with OpenGLES

Wed Jan 28, 2015 8:51 pm

My problem is the lack of information about OpenGLES with Python, I need some guides to teach me this, I have already used PyOpenGL but only with deprecated functions.

gkreidl
Posts: 5714
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany

Re: Python with OpenGLES

Wed Jan 28, 2015 9:09 pm

Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

Hoche96
Posts: 10
Joined: Wed Jan 28, 2015 6:54 pm

Re: Python with OpenGLES

Wed Jan 28, 2015 9:23 pm

Thanks, that's fine, I will look into this.

User avatar
PeterO
Posts: 4246
Joined: Sun Jul 22, 2012 4:14 pm

Re: Python with OpenGLES

Wed Jan 28, 2015 11:05 pm

Excuse me, but when I suggested pi3d you said it wasn't what you wanted ! :evil:
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),Aeromodelling,1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

Hoche96
Posts: 10
Joined: Wed Jan 28, 2015 6:54 pm

Re: Python with OpenGLES

Thu Jan 29, 2015 4:52 am

Yeah not really, but it has documentation and I will look into to. I want to work just with OpenGLES, with PyOpenGL or so.

-rst-
Posts: 1316
Joined: Thu Nov 01, 2012 12:12 pm
Location: Dublin, Ireland

Re: Python with OpenGLES

Thu Jan 29, 2015 11:52 am

Hoche96 wrote:My problem is the lack of information about OpenGLES with Python, I need some guides to teach me this, I have already used PyOpenGL but only with deprecated functions.
Are you saying this http://pyopengl.sourceforge.net/context ... index.html is not any good?

I have been thinking of learning some OpenGL myself and have been considering languages and libraries to use - was going to give this a go...
http://raspberrycompote.blogspot.com/ - Low-level graphics and 'Coding Gold Dust'

Hoche96
Posts: 10
Joined: Wed Jan 28, 2015 6:54 pm

Re: Python with OpenGLES

Thu Jan 29, 2015 12:32 pm

It's, I would say a good library, but there is only one tutorial for it and I even don't know how to get GLES2 to work. If someone knows how this library exactly works, please tell me.

-rst-
Posts: 1316
Joined: Thu Nov 01, 2012 12:12 pm
Location: Dublin, Ireland

Re: Python with OpenGLES

Thu Jan 29, 2015 3:05 pm

Sorry, not quite sure what you mean with that and the earlier comment on already using PyOpenGL...

Did you install PyOpenGL onto a Raspberry Pi?
Did it work?
Did you try the tutorial?
Did it produce any output?

The intro http://pyopengl.sourceforge.net/context ... intro.html says it "It tries to avoid the use of "legacy" OpenGL entry points as much as possible." so what do yo mean by 'deprecated functions'?

To me the tutorial seems fairly thorough. After that it would require looking at tutorials in different programming languages and interpolating to Python - the GL* functions, datastructures and principles are the same...

And to my understanding any GL stuff using shaders on RaspberryPi will always be GLES2?
http://raspberrycompote.blogspot.com/ - Low-level graphics and 'Coding Gold Dust'

Hoche96
Posts: 10
Joined: Wed Jan 28, 2015 6:54 pm

Re: Python with OpenGLES

Thu Jan 29, 2015 4:40 pm

I used another tutorial from YouTube but it used the legacy OpenGL.
-rst- wrote:And to my understanding any GL stuff using shaders on RaspberryPi will always be GLES2?
That's my question, I don't really know how this works. But I think it interpolate it to OpenGLES because it is in some ways compatible. Also some errors occured with GLSL 1.2, so I don't really think it's the right way and I know how to call explicit OpenGLES2 and use it's functions.

I think I learn C and then use OpenGLES2, after I can handle it I will bring it to Python for simplicity. I hope then I will understand PyOpenGL.

User avatar
PeterO
Posts: 4246
Joined: Sun Jul 22, 2012 4:14 pm

Re: Python with OpenGLES

Thu Jan 29, 2015 5:14 pm

Hoche96 wrote:I used another tutorial from YouTube but it used the legacy OpenGL.
-rst- wrote:And to my understanding any GL stuff using shaders on RaspberryPi will always be GLES2?
That's my question, I don't really know how this works. But I think it interpolate it to OpenGLES because it is in some ways compatible. Also some errors occured with GLSL 1.2, so I don't really think it's the right way and I know how to call explicit OpenGLES2 and use it's functions.

I think I learn C and then use OpenGLES2, after I can handle it I will bring it to Python for simplicity. I hope then I will understand PyOpenGL.
GLES2 is GLSL (shader language) based, so the biggest thing to lean about is the writing of vertex and fragment shaders. It won't matter which language (C/Python) you use as the shaders will still look the same as they written as "source code" held in strings which are passed into the GLSL compiler by your program at run time. If you alread know Python I would say stick with that rather than trying to learn C and GLSL/GLES at the same time.

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),Aeromodelling,1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

Hoche96
Posts: 10
Joined: Wed Jan 28, 2015 6:54 pm

Re: Python with OpenGLES

Thu Jan 29, 2015 5:58 pm

Ah okay. Thanks for clarifying. I can a bit C++ so C shouldn't be such a problem and low-level programming is great for understanding the things better.

User avatar
paddyg
Posts: 2196
Joined: Sat Jan 28, 2012 11:57 am
Location: UK

Re: Python with OpenGLES

Fri Jan 30, 2015 12:08 am

I think pygame and kivy also give pretty immediate access to the OpenGLES2 functionality, and both will run on the RPi. Pi3d took the option of accessing the libGLESv2.so library using ctypes. This means that the 'wrapping' is pretty light weight and you can call gl functions directly in your code if you want, but you have to do all the correct conversion to and from the required ctype
also https://groups.google.com/forum/?hl=en-GB&fromgroups=#!forum/pi3d

Return to “OpenGLES”

Who is online

Users browsing this forum: No registered users and 1 guest