User avatar
abishur
Posts: 4477
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
Contact: Website

Re: Using openGL?

Mon Apr 23, 2012 3:23 pm

I was curious, is it possible to use openGL outside the X server?  I was trying to and it said it couldn't find any openGL drivers, but I was pretty sure the pi came with them.  Does anyone know how I can activate those or where I need to point the program?
Dear forum: Play nice ;-)

User avatar
teh_orph
Posts: 346
Joined: Mon Jan 30, 2012 2:09 pm
Location: London
Contact: Website

Re: Using openGL?

Mon Apr 23, 2012 3:42 pm

If you've not yet come across it there's a sample for full-screen OpenGL *ES* that lives in /opt/vc (called 'triangle' or something). Link libraries are in there too. I don't have an rpi myself but my understanding is that it will still run full screen whilst X is running.

I'm currently working on "OpenGL ES in an X window" so confirmation of full-screen 3D on top of X would be great

rmm200
Posts: 259
Joined: Sat Mar 03, 2012 10:25 pm

Re: Using openGL?

Mon Apr 23, 2012 3:42 pm

Shees Abishur - you of all people I would expect to give a complete description.

I am guessing your problem is on Debian? Did you try Fedora?  Support might not be in Debian yet? Is python-opengl installed?

What is the name of the Broadcom blob and is it present?

My understanding is that OpenGL has nothing to do with the X server, and the current problem with the X Server not having accelerated graphics is that it is not using OpenGL for rendering. Could be very wrong on this...

Try the demo of Quake (Doom?) that does use accelerated graphics to see if it is in your base Linux.

User avatar
abishur
Posts: 4477
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
Contact: Website

Re: Using openGL?

Mon Apr 23, 2012 3:56 pm

I am using debian, but in this case, I just wanted to know if it was possible in general   I'll see if I can get it looking in the right spot for them.
Dear forum: Play nice ;-)

rmm200
Posts: 259
Joined: Sat Mar 03, 2012 10:25 pm

Re: Using openGL?

Mon Apr 23, 2012 4:08 pm

My comment was based on the fact I have you in the box marked "Technically Competent".

It is not a very big box and you are not crowded...

knobby67
Posts: 40
Joined: Fri Mar 09, 2012 9:18 am

Re: Using openGL?

Mon Apr 23, 2012 5:00 pm

I've had SDL  running many times on ARMs with no x running.  I've never used opengl as none of them had the performance,  but I would assume it would run as SDL make the "screen/surface" for you.

User avatar
abishur
Posts: 4477
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
Contact: Website

Re: Using openGL?

Mon Apr 23, 2012 5:00 pm

teh_orph said:


If you've not yet come across it there's a sample for full-screen OpenGL *ES* that lives in /opt/vc (called 'triangle' or something). Link libraries are in there too. I don't have an rpi myself but my understanding is that it will still run full screen whilst X is running.

I'm currently working on "OpenGL ES in an X window" so confirmation of full-screen 3D on top of X would be great



Interesting... I don't see *anything* like that and video stuff is way outside my knowledge domain so I'm not being much help here I fear.
Dear forum: Play nice ;-)

Phoenix RasPi
Posts: 19
Joined: Thu Mar 29, 2012 12:42 am

Re: Using openGL?

Mon Apr 23, 2012 5:38 pm

Do we need to copy/rename any of the OpenGL ES files in /opt/vc/lib on Debian to the OpenGL directories in Python in order to get OpenGL working with PyGame?  After installing/building PyOpenGL from the web, import from OpenGL appears to work within a Python program, but, when trying to execute pygame.display.set_mode((640,480), OPENGL|DOUBLEBUF), the OPENGL flag causes a pygame.error to be thrown.

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5288
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Using openGL?

Mon Apr 23, 2012 5:49 pm

OpenGL is not the same as OpenGL ES.

You can't run openGL apps with the OpenGL ES library - the API is substantially different and they need porting.

Now, OpenGL should be possible, in a slow/software/unaccelerated way. I've ran glxgears for example. But it probably won't be fast enough to be usable.

If you are interested in Python and OpenGL ES, then you should keep an eye on:

https://github.com/peterderivaz/pyopengles

Peter is a very clever guy, and fortunately he's been poking around with python bindings for opengles and openmaxil. It's probably a little early to start using, but that will be the simple route for accelerated 3D and video on the Pi in the future.

rmm200
Posts: 259
Joined: Sat Mar 03, 2012 10:25 pm

Re: Using openGL?

Mon Apr 23, 2012 5:56 pm

OK - we could really use some documentation here.

The Broadcom blob exposes it's API to what - OpenGL ES 2.0?

OpenGL is really barking up the wrong tree and will never be accelerated on Pi?

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5288
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Using openGL?

Mon Apr 23, 2012 6:31 pm

Yes, OpenGL will never be accelerated on the Pi (or any embedded processor I expect).

OpenGL comes from a very different design goal from OpenGL ES. OpenGL is typically rendered in an immediate mode that would be hugely inefficient on "tile mode deferred renderer" like BCM2835.

Broadcom blob support openGLES 1.1 and openGLES 2.0. (and openVG/openMAX IL).

See: http://www.khronos.org/ for lots of docs about these libraries.

rmm200
Posts: 259
Joined: Sat Mar 03, 2012 10:25 pm

Re: Using openGL?

Mon Apr 23, 2012 6:35 pm

Thanks for that!  Unwinding my OpenGL research and switching to OpenGL ES.

This at all related to Abishur's problems?

User avatar
abishur
Posts: 4477
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
Contact: Website

Re: Using openGL?

Mon Apr 23, 2012 6:36 pm

darn.  And I'm guessing there's no such thing as an openGL to OpenGL ES wrapper to have openGL programs use the GL ES instructions instead.
Dear forum: Play nice ;-)

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5288
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Using openGL?

Mon Apr 23, 2012 7:08 pm

Abishur said:


darn.  And I'm guessing there's no such thing as an openGL to OpenGL ES wrapper to have openGL programs use the GL ES instructions instead.



None that work. There are a few aborted efforts. It's just not possible to make a wrapper that is feature complete and efficient. You have to port the code at a higher level (e.g. draw_model type layer rather than glBegin...)

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23083
Joined: Sat Jul 30, 2011 7:41 pm

Re: Using openGL?

Mon Apr 23, 2012 9:38 pm

dom said:


OpenGL is not the same as OpenGL ES.

You can't run openGL apps with the OpenGL ES library - the API is substantially different and they need porting.

Now, OpenGL should be possible, in a slow/software/unaccelerated way. I've ran glxgears for example. But it probably won't be fast enough to be usable.

If you are interested in Python and OpenGL ES, then you should keep an eye on:

https://github.com/peterderivaz/pyopengles

Peter is a very clever guy, and fortunately he's been poking around with python bindings for opengles and openmaxil. It's probably a little early to start using, but that will be the simple route for accelerated 3D and video on the Pi in the future.


There is also an existing Python binding, PyGLESv2 but the examples for it use windows rather than Xlib - and I've run out of time to fix it at the moment.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

Phoenix RasPi
Posts: 19
Joined: Thu Mar 29, 2012 12:42 am

Re: Using openGL?

Tue Apr 24, 2012 12:11 am

Thanks Dom.  Do you happen to know where the OpenGL ES /opt/vc/lib/… files should be copied/linked to within Python (e.g., /usr/local/lib/Python2.6/dist-packages … ) so that the egl, gl2, and gl2ext modules in pyopengles.py can be imported?  I don"t see any way to contact Peter directly via his GitHub repos or here.

I"m in contact with JamesH about a pure Python wrapping of OpenGL ES that he had been working on, also.  I think it"s vitally important for students to be awed by being able to create games using hardware-accelerated 3-D graphics via Python just as we created 2-D games in BASIC on the early personal computers a generation ago.  We haven"t lived in FlatWorld since the X-Box and PS/3 were introduced, and that"s a big part of what we"re competing with for students" attention.  I can"t think of anything more important, other than the getting-started RasPi documentation for complete novices to computing.

User avatar
Jim Manley
Posts: 1600
Joined: Thu Feb 23, 2012 8:41 pm
Location: SillyCon Valley, California, and Powell, Wyoming, USA, plus The Universe
Contact: Website

Re: Using openGL?

Tue Apr 24, 2012 12:33 am

The Python wrapper for ES is of high interest to me, as it might save me a lot of work in implementing the Pi-finity! game.  Otherwise, I'll have to perform some of the same effort using ES via the blob APIs that I am under the impression exist in /opt/vc/lib/...  Speaking of those APIs and lib files, are they documented anywhere?  I'd like to help get that info into the wiki in a form that's approachable by non-experts.
The best things in life aren't things ... but, a Pi comes pretty darned close! :D
"Education is not the filling of a pail, but the lighting of a fire." -- W.B. Yeats
In theory, theory & practice are the same - in practice, they aren't!!!

shirro
Posts: 248
Joined: Tue Jan 24, 2012 4:54 am

Re: Using openGL?

Tue Apr 24, 2012 12:56 am

Jim, the headers in /opt/vc/include are mostly the standard Khronos ones and there is documentation (EGL, OpenGL ES) on the Khronos site as well as tutorials and books around. Unfortunately it looks like a lot of the ES stuff is aimed at Android or IOS but since ES is a subset I guess lessons can be applied from other modern opengl texts.

I don't know that programming OpenGL ES in C and writing texture and fragment shaders is something that is ever going to be approachable by non-experts but I guess the idea of the Pi is help us all become more expert. It is something I am hoping to experiment with on my Pi. If you want to have a play with GLSL and have a modern computer with 3d graphics you might want to check out http://glsl.heroku.com/ as WebGL is basically OpenGL ES

There are some undocumented Broadcom EGL functions in the libraries which might be interesting for more advanced use (perhaps with X Windows or Wayland) but I guess we just have to wait and see on those. For the rest I would say it is all pretty standard.

User avatar
Jim Manley
Posts: 1600
Joined: Thu Feb 23, 2012 8:41 pm
Location: SillyCon Valley, California, and Powell, Wyoming, USA, plus The Universe
Contact: Website

Re: Using openGL?

Tue Apr 24, 2012 2:46 am

Thanks, shirro.  I had gotten the impression that Eben, JamesH, et al, were providing some sort of bundle of the ES APIs, including anything special to know about using the GPU blob (there are Easter eggs in the blob?  Do tell!  Of course, eggs as a Python pun is fully intended ).  Fortunately, I'm already pretty well-versed at ES 2.0 from iOS and WebGL (although I don't know of anyone who can remember it all without looking stuff up), so, I've got a leg up that most probably don't.

One of the most fundamental goals of Pi-finity! is to provide a means for kids of all ages to create 3-D worlds and games (whatever they turn out to be, sophistication-wise) without having to become Jim Clark (SGI founder and GL/OpenGL inventor) level experts at geometry pipeline manipulation.  Although some bemoaned the move from ES 1.1 to 2.0 to become more aligned with the workflow in OGL 3.x (and 4.0 this year?), including GLSL, etc., the flexibility that provides more than outweighs the increased effort needed to get even just a tetrahedron with different-colored sides spinning under moving light sources.

I have enough experience with OGL (and GL before it), ES (essentially now a subset of OGL), and effective user interface design that I at least have an inkling about what can be done and, I hope, better ways to do it, in terms of providing world/game-creation tools (much of which I'm hoping to leverage from lessons learned by others developing earlier game engines and tools).  I am going to need help with some of the more gnarly details about how things are organized and implemented in the Pi.  However, I've been fortunate enough to attract the attention of some developers here who also have decades of 3-D and game development experience (not all with GL-based technology, though).  Between us, I hope we can all work with the Foundation developers to get some impressive 3-D Pi stuff off the launch pad sooner, rather than later.

It's been interesting doing my initial work on a Pi via ssh and VNC to the UK from SillyCon Valley.  It's crashed/frozen an average of about once a day, but, that may be due to a flaky micro-USB power cable.  It reminds me of my days remotely logged into an SGI Iris 2400 workstation from my house late at night, solely on the command line over a 1,200 bps modem.  Back then, I couldn't see what was going on with the display, and I had to either wait until the last users had logged off for the night, or Unix-messaged them to coordinate me blasting something onto the display (which wasn't always quite as coordinated as some liked ).

Of course, all I could do was verify that my code didn't core dump, and that status messages echoed to the command line and log files showed that things appeared to be working.  I wouldn't get to do visual debugging until the next day/evening when my hour, or so, of reserved display time in the lab was available.  Thank God (and an IBM resarcher, IIRC) for VNC, along with the folks who have brought us international fiber-optic network speeds.  I'm typically only seeing about 200 ~ 500 ms delays round-trip!  That sure beats the pants off operating blind and rapidly earning frequent-flier miles on red-eyes between SFO and LHR

The young whippah-snappahs today have no idea how good they've got it, dad-gummit!
The best things in life aren't things ... but, a Pi comes pretty darned close! :D
"Education is not the filling of a pail, but the lighting of a fire." -- W.B. Yeats
In theory, theory & practice are the same - in practice, they aren't!!!

rmm200
Posts: 259
Joined: Sat Mar 03, 2012 10:25 pm

Re: Using openGL?

Tue Apr 24, 2012 3:08 am

I just hope all you folks setting up things on the Pi will document (Tutorial?) the process for the rest of us...

Any good reference books on OpenGL ES anyone would like to recommend?

User avatar
jojopi
Posts: 3078
Joined: Tue Oct 11, 2011 8:38 pm

Re: Using openGL?

Tue Apr 24, 2012 3:33 am

Jim Manley said:

Thank God (and an IBM resarcher, IIRC) for VNC, along with the folks who have brought us international fiber-optic network speeds.
VNC was invented at Olivetti Research Laboratory in Cambridge.  Founded by Hermann Hauser and Andy Hopper of Acorn fame.

User avatar
Jim Manley
Posts: 1600
Joined: Thu Feb 23, 2012 8:41 pm
Location: SillyCon Valley, California, and Powell, Wyoming, USA, plus The Universe
Contact: Website

Re: Using openGL?

Tue Apr 24, 2012 4:42 am

rmm200 said:


I just hope all you folks setting up things on the Pi will document (Tutorial?) the process for the rest of us...


Looks like that job is going to be mine, unless I can convince someone else to beat me to it (I'll even accept frogs in payment for the privilege of white-washing my fence ).


Any good reference books on OpenGL ES anyone would like to recommend?


I haven't read a book on software in over a dozen years.  Everything I've ever needed since then is a Google search away on-line, in the documentation (such as it often isn't), or a chat/forum post away (info often not in _any_ book).  That being said, the Khronos,org site has some brief roadmap bullet points, man pages on ES APIs, no tutorials, and little else.  I'll see if I can dig some tutorial and example URLs out of my notes from Days of Yore.
The best things in life aren't things ... but, a Pi comes pretty darned close! :D
"Education is not the filling of a pail, but the lighting of a fire." -- W.B. Yeats
In theory, theory & practice are the same - in practice, they aren't!!!

User avatar
Jim Manley
Posts: 1600
Joined: Thu Feb 23, 2012 8:41 pm
Location: SillyCon Valley, California, and Powell, Wyoming, USA, plus The Universe
Contact: Website

Re: Using openGL?

Tue Apr 24, 2012 5:04 am

jojopi said:


VNC was invented at Olivetti Research Laboratory in Cambridge.  Founded by Hermann Hauser and Andy Hopper of Acorn fame.


Aaaah, that lab in the UK was owned by an Italian company, it was bought by an American Three Letter Acronym (TLA), AT&T, not IBM, and the inventors formed yet-another American company, RealVNC.  I'm sure the Uzbeks were involved somehow, but, I'll need to do some more research to prove it.  I'm just going to encapsulate everything in a Wikipedia URL from now on, so I don't have to try to remember anything any more.  If only there were some kind of machine that could automagically remember such trivia for us ...
The best things in life aren't things ... but, a Pi comes pretty darned close! :D
"Education is not the filling of a pail, but the lighting of a fire." -- W.B. Yeats
In theory, theory & practice are the same - in practice, they aren't!!!

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5288
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Using openGL?

Tue Apr 24, 2012 8:44 am

@Phoenix RasPi try updating GitHub, Peter has committed some missing files.

peterpi
Posts: 42
Joined: Wed Jan 04, 2012 3:28 pm

Re: Using openGL?

Tue Apr 24, 2012 8:53 am

rmm200 said:


Any good reference books on OpenGL ES anyone would like to recommend?


I have this one and I found it spot on:  http://opengles-book.com/

Return to “General discussion”