dch26
Posts: 23
Joined: Fri Jun 29, 2012 3:32 pm
Location: UK

Pi, OpenGLES & Perl

Fri Jun 29, 2012 4:11 pm

Hi all,

i have done a mammoth amount of forum searching and googling before posting this....because i hate asking "the same old questions..."

I sit here, armed with a Raspberry Pi, running Raspian OS.
I am an experienced Perl programmer and am proficient using it with desktop OpenGL.

made the obvious first move (before researching) of installing the OpenGL perl module, copying one of my desktop perl scripts to the pi and trying to run it.

this worked when i was running the X environment at a glorious 0.005 frames per second. so clearly we were software rendering. then i got the picture that X was not 3d capable. fine. lets kill that and drop back to command prompt. with no X running we then hit a plethora of issues.

firstly......the Pi needs to have its opengl context kicked off by the egl library. In perl, we dont have a perl module for this. although capable with perl, i am not so good with C, so building the XS wrapper and creating the module is a big ask.

i have the C samples compiled and running......various red triangles :) and a particle system from the Raspi "benosteen" collection. also python samples working. as i said, i dont speak much C, and dont want to pollute my scripting brain with python just now. besides, on a desktop, perl provides better performance with opengl than python - so clearly thats the way i want to go.

i am aware the opengl es 2.0 is a huge change in the way we code our 3d apps......but i notice that Pi also supports 1.x

i have seen a wrapper for python for opengl es 2.0 and a ruby wrapper for 1.x

can i just confirm that my understanding is correct:
- Pi is never going to run 3d accelerated OpenGL (software only)
- it is capable of 3d accelerated OpenGL ES 1.x (frowned upon)
- the ultimate is OpenGL ES 2.0

if correct, then to make the most of the Pi, i've also got to get perl wrappers created for:
- gl2.h
- gl2ext.h
- gl2platform.h

if i were to get the egl wrapper done........would i be able to use OpenGL ES 1.x on the Pi?
(using the existing OpenGL.pm)

i am assuming that the performance of 1.x on the Pi wont be as good as 2.0 but it might
be a temporary comprimise while the 2.0 wrappers are created & while my opengl skills migrate to 2.0 language (with all the nasty scary shaders!)

is anyone else working on this? anyone else interested?

i would be very interested in collaberating - code, testing, documentation, samples, etc

sorry this post is a little dis-jointed - have far too many thoughts & questions floating around in my shell-like.

cheers

dch

Gibble
Posts: 56
Joined: Wed May 09, 2012 9:52 am

Re: Pi, OpenGLES & Perl

Sun Jul 01, 2012 7:42 pm

Hi Dhc, here's a disjointed reply to match ;). I've previously had a fiddle with POGL (not on Pi), and fiddled with PyOpenGLES on the Pi using OpenGLES 1 & 2. I think the POGL route would probably be the way to go, I have no idea how easy it would be to adapt this though, I would assume pretty tricky.

Python does cope fine with 1.0 Opengles and 2.0, so no technical reason why Perl couldn't do this.
1. I don't think its possible ever for Perl to run OpenGL on the Pi (without some weird hack that wasn't really OpenGL).
2. It is capable of 1.0, as well as 2.0
3. I think personally 2.0 is the way to go in terms of learning and development for the future. I don't think there is anything wrong with getting something up and running at first in 1.0 though, and Python 3d framework peoeple are working on is currently 1.0. I've been trying to learn 2.0, but I have found it challenging and pretty much beyond me. I am persisting though for better understanding.

1.0 vs 2.0 performance I don't think is as conclusive as you may think, and I've personally found 2.0 slower, but thats as I have coded things differently, so not a good comparison. I have a suspicion some may be down to the Pi doing software floating point, and my matrices (Not on raspbian though I think, which is something I'll hopefully test soon, see if raspbian improves performance a lot). Its quite hard (for me), to follow what is done via hardware and what via software with OpenGL*.

I would be interested in helping out testing, fluffing about, but I don't have the ability to properly develop anything relating to XS, C etc.

Gibble
Posts: 56
Joined: Wed May 09, 2012 9:52 am

Re: Pi, OpenGLES & Perl

Mon Jul 02, 2012 4:19 pm

Actually using Raspbian makes no difference at all to me, so I'm probably misunderstanding something :).

dch26
Posts: 23
Joined: Fri Jun 29, 2012 3:32 pm
Location: UK

Re: Pi, OpenGLES & Perl

Mon Jul 02, 2012 4:41 pm

have decided to bite the bullet and get on with it.

i am creating my own wrapper libraries.
i have done the "bcm_host" and am halfway thru the "egl".

checking the functions work through a test perl script as i go.

will keep you posted. this may take a little time & be an iterative process because my knowledge of C is limited!

i am assuming (remembering that assumption can be the mother of all ***) that after i have got the bcm_host & egl libraries wrapped - that i will be able to use the existing OpenGL library wrappers to actually draw something. i DO NOT want to have to build those.........will need more/better brains for that..

cheers
dch

Gibble
Posts: 56
Joined: Wed May 09, 2012 9:52 am

Re: Pi, OpenGLES & Perl

Tue Jul 03, 2012 2:44 pm

How were you thinking of dealing with things like array types for OpenGLES out of interest ? Speedwise, with Python I think I've found one of the slowdowns is any type of array type conversion. POGL seemed to get around this, but my eyes glaze over when I look at some of that code :).

dch26
Posts: 23
Joined: Fri Jun 29, 2012 3:32 pm
Location: UK

Re: Pi, OpenGLES & Perl

Wed Jul 04, 2012 3:55 pm

if you are interested in this thread, please see:

http://www.raspberrypi.org/phpBB3/viewt ... 37#p115737

cheers
dch

harwoodr
Posts: 19
Joined: Sat Jun 02, 2012 6:20 am
Location: Colchester. Essex.UK

Re: Pi, OpenGLES & Perl

Wed Jul 11, 2012 5:40 am

Regarding perl and opengl take a look at www.harwoodrandd.com go to the forum perl or breaking news some good stuff on there and some video of dch's work soon
you are only as good as you strive to be ! no pain -no gain

dch26
Posts: 23
Joined: Fri Jun 29, 2012 3:32 pm
Location: UK

Re: Pi, OpenGLES & Perl

Thu Jul 12, 2012 7:37 am

success with opengles 2.0, perl & pi :)

if you are interested, please see:

http://www.raspberrypi.org/phpBB3/viewt ... 43#p121543

cheers
dch

Return to “OpenGLES”