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

Re: Using openGL?

Sun Apr 29, 2012 12:06 pm

Aren't they compiled at run-time? I'm sure it's done in the binary blob...
Do you get anything interesting from glGetShaderiv with GL_COMPILE_STATUS or glGetShaderInfoLog after invoking glCompileShader?

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

Re: Using openGL?

Sun Apr 29, 2012 12:22 pm

@shirro

https://github.com/peterderivaz/pyopeng ... pengles.py

Some example code that uses GLSL. In python, but the API directly maps to C.

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

Re: Using openGL?

Sun Apr 29, 2012 12:27 pm

@teh_orph that is my understanding. @dom I have just copied over a gles2 example from somewhere else and added the broadcom things and it looks very similar to the Python example.

glGetShaderiv with GL_COMPILE_STATUS is giving be GL_FALSE and glGetShaderInfoLog has length 0. I have the qt5 demos in opt and the thing obviously has shaders judging by some of those demos.

After running around in circles for awhile I put glGetBooleanv(GL_SHADER_COMPILER, &hasCompiler) in there and it returns GL_FALSE.

I am tired. I have probably overlooked something simple. I might just try it again tomorrow.

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

Re: Using openGL?

Sun Apr 29, 2012 12:52 pm

Are you setting the context to ES2? E.g.

context_attribs = eglints( (EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE) )

self.context = openegl.eglCreateContext(self.display, config, EGL_NO_CONTEXT, ctypes.byref(context_attribs))

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

Re: Using openGL?

Sun Apr 29, 2012 1:09 pm

@dom - yes that is it. Thanks.

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?

Sun Apr 29, 2012 7:46 pm

ArborealSeer said:


not long til they're more available i guess! and people including myself may end up having a 'spare' pi they can let you have (at what they paid for em + shipping) if they had orders with farnell+rs.


No one in their right mind is going to sell a board they never intended to keep for their cost and shipping to me if they can get several times what they paid until probably after my board arrives, when the supply should make the ePrey option go away.


i doubt this will work due to the x support.. but figured it was worth mentioning..

VirtualGL is an open source program which redirects the 3D rendering commands from Unix and LinuxOpenGL applications to 3D accelerator hardware in a dedicated server and displays the rendered output interactively to a thin client located elsewhere on the network.

http://en.wikipedia.org/wiki/VirtualGL

http://www.virtualgl.org/


I know of this from Sun's former Visualization System but, as you noted, the X integration is a show-stopper, since we can't run ES in X.  Thanks for the idea, though.  Since it is open-source, I wonder if it would be possible to use the redirection code in it to send the ES calls to my remote system for rendering.  That wouldn't incur the GPU loading on the Pi, so, it wouldn't be a faithful rendition of actual native operation, but, it would be better than what I have now.

Of course, by the time I got it figured out, there would be Pi boards available to the rafters as the ePrey rats wind up bailing on later orders when the bids dry up.  If people who bought the Pi just to see what all the buzz was about discover just how unfinished it is and really don't know what to do with it, that may help advance the time when boards will become more plentiful.  Based on distributor non-information, it looks like that's still at least three months away, and I have things on my real-world schedule starting right about then that are going to start impacting on my time available for Pi projects.

We've already lost six months beyond the original estimated date of board availability and, while I understand the issues that led to the delays, there isn't much understanding going in the other direction.  When there's insufficient third-party software and documentation when the Foundation really needs it in the future, they can look back on these months as a serious lost opportunity.  I'm as fervent a supporter of the Foundation's goals as anyone, but, the facts are the facts, and third party developers have no responsibility for them.

Ah well, Sunday, bloody Sunday.
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
ArborealSeer
Posts: 300
Joined: Tue Jan 24, 2012 9:48 am
Location: South West, UK

Re: Using openGL?

Sun Apr 29, 2012 9:34 pm

Jim Manley said:

ArborealSeer said:

not long til they"re more available i guess! and people including myself may end up having a "spare" pi they can let you have (at what they paid for em + shipping) if they had orders with farnell+rs.

No one in their right mind is going to sell a board they never intended to keep for their cost and shipping to me if they can get several times what they paid until probably after my board arrives, when the supply should make the ePrey option go away.

I guess when the first 'spare's turn up, eprey won't be fetching much of a premium anyways. It would be kind of nice to pick n choose where a pi ends up..
Pi Status > Farnell, Arrived 24/5- RS, Arrived 1/6

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

Re: Using openGL?

Sun Apr 29, 2012 9:34 pm

What makes you think that these months are not being put to good use? Just because you can't see much going on, doesn't mean there isn't a lot going on. Remember, alpha boards have been out for a while to some pretty clever people, and early betas were retained by the Foundation to get to people doing real work and documentation. And for journo's, but we don't count them as real work.

And look how fast stuff is being sorted out now that boards are hitting the customers.
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."

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?

Sun Apr 29, 2012 10:45 pm

JamesH - I'm not talking about those who are already Foundation-blessed, especially the Broadcom low-level coders and OS-porters, blessed be thine names.  There are some number of application developers (I would guess a couple of hundred at the outside, based on posts here) who were under the impression that boards would be available by launch for the purpose of getting software developed more familiar to humans than kernels, especially in the education space before the beginning of the coming academic year, even if only in beta form.  Time, tide, and formation wait for no man (or woman).
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!!!

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

Re: Using openGL?

Mon Apr 30, 2012 6:19 am

Wasn't talking about the Broadcom or OS people - others more aimed at education have also had early boards.
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."

Pickle
Posts: 68
Joined: Tue Sep 20, 2011 5:09 pm

Re: Using openGL?

Mon Apr 30, 2012 2:13 pm

X does not need to be modified, i think X composting support is being confused with just using the X surface with EGL. EGL is the only thing that needs to be modified to support rendering into the X surface and into the X display.

On the pandora we use standard software driven X, the powervr EGL driver has support for direct rendering to the framebuffer or the X window. For X you give it the X display and the reference to the X surface and it just works. I assume the EGL driver does some things to make this work. But Broadcom should provide support for this.

Again this does not accelerate any of the 2d X operations behind the scene in the server, it just lets you render your 3d into the X buffers. The main benefit is that you dont have to fight X for control of the framebuffer and have flickering.

One other ive been wondering, is fbset supported?, was dispmanx a broadcom attempt to replace it?

User avatar
ArborealSeer
Posts: 300
Joined: Tue Jan 24, 2012 9:48 am
Location: South West, UK

Re: Using openGL?

Mon Apr 30, 2012 8:19 pm

(issues about the usefulness of doing gl in x with limited resources aside…)

that sounds intriguing..
Pi Status > Farnell, Arrived 24/5- RS, Arrived 1/6

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

Re: Using openGL?

Wed May 02, 2012 11:04 pm

I have a very basic test runner cobbled together that I am using to run some fragment shaders from webgl demo sites. I will chuck it up on github next week once I have tidied it up a bit.

The framerate is very poor compared to my old laptop. I am not complaining as it is still amazing for $35. But these full HD resolutions don't help either. Raymarching fragment shaders at full HD are off the list.

I am wondering if anyone with more experience with the videocore iv has any hints to how best to show it off. What does it do really well? Are there optimisation tricks?

Also - trying to debug GLSL is crazy - who invented this stuff?

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?

Thu May 03, 2012 2:27 am

shirro said:

I have a very basic test runner cobbled together that I am using to run some fragment shaders from webgl demo sites. I will chuck it up on github next week once I have tidied it up a bit.


Very much appreciated! I take it this is going to the framebuffer?

The framerate is very poor compared to my old laptop. I am not complaining as it is still amazing for $35. But these full HD resolutions don"t help either. Raymarching fragment shaders at full HD are off the list.


Is this running ES on the GPU?

I am wondering if anyone with more experience with the videocore iv has any hints to how best to show it off. What does it do really well? Are there optimisation tricks?

Also - trying to debug GLSL is crazy - who invented this stuff?


Debugging GLSL is easy as Pi ... _if_ your brain runs the variant of gdb that doesn"t exist for GLSL. Those of us who started with Original Flavor GL in The Early Days would have killed to get GLSL ... mainly because we just barely had hidden-surface removal available! Gouraud shading of each polygon based on colors along each polygon-pair edge had to be done manually, or at least our code had to compute it until the GL API was expanded to include it. GLSL is essentially K&R C ... go complain to them - I"m sure they"ll be totally sympathetic!

Seriously, I think some of my SIGGRAPH buddies here in the Valley of SillyCons (which includes folks currently/previously at Pixar, Apple, AutoDesk, PDI, ILM, Digital Domain, SGI, NVIDIA, ATI, etc.) may have some tools we can use on an educational basis. They won"t run on the Pi, of course, but, will be fine on typical dev boxes with decent GPU cards we all are likely using. Once you"ve got your shaders tweaked, then just dump them into the Pi build (at least, that"s the theory - Murphy likely has other ideas ).
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?

Thu May 03, 2012 3:24 am

Jim Manley said:


shirro said:


I have a very basic test runner cobbled together that I am using to run some fragment shaders from webgl demo sites. I will chuck it up on github next week once I have tidied it up a bit.


Very much appreciated! I take it this is going to the framebuffer?


Yes. You can run it in X if you want but it runs full screen. It is trivially simple - has to be I am not much of a programmer. I wanted a simple shader runner that will compile for Mesa, /dev/fb0 EGL (that will work on some other arm boards) and the Pi to do side by side comparisons. It just loads a fragment shader and sets up stuff like time and screen resolution as uniform parameters. I need to add a few bits like framerate counter, fix the error handling and clean it up. I also want to add inotify so it can do a watch on the shader file and reload it when it is edited.



The framerate is very poor compared to my old laptop. I am not complaining as it is still amazing for $35. But these full HD resolutions don"t help either. Raymarching fragment shaders at full HD are off the list.


Is this running ES on the GPU?


Yes. I am sure you can throw a stack of geometry and some textures at the GPU and will be fine but some of the demoscene style stuff really kills it (especially at full HD) and really that is all I can look at just throwing fragment shaders at a quad.



Also - trying to debug GLSL is crazy - who invented this stuff?


Debugging GLSL is easy as Pi ... _if_ your brain runs the variant of gdb that doesn"t exist for GLSL.


Yeah, I seemed to have missed out on that. And the handbook that explains the entire OpenGL rendering pipeline for dummies.


Once you"ve got your shaders tweaked, then just dump them into the Pi build (at least, that"s the theory - Murphy likely has other ideas ).


That is the theory. Unfortunately cutting and pasting a well tested webgl shader doesn't seem to be any guarantee that it will work. I know some use extensions that will not be available but others I just can't see what is wrong. I have regressed one step further than printf debugging to commenting out blocks of code to see which ones cause the problem and not having much luck. Kids running around and screaming probably isn't helping.

Return to “General discussion”