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

Re: Using openGL?

Thu Apr 26, 2012 2:19 pm

Lot of things getting mixed together, which really should not be.

OpenGL (typically immediate mode API for fixed pipline) has to be converted to ES API. This is mainly using vertex arrays. but there are other things to be aware of.

Everything else is setting up the render context and window. X or GLX on a normal desktop is providing this. With ES systems this is now done through EGL. You use EGL and give it the window surface you intend to render to. In the case with X you would pass an X window surface. If your running on a raw console you can give it a NULL and it should open the framebuffer directly. Keep in mind you can render to the framebuffer while X is running, but you will have flicking as X and your app both are drawing to the screen.

It is also possible to use software SDL to obtain the window (which is really just an X window). My project EGLport http://sourceforge.net/project.....=directory

shows this method and the raw framebuffer methods.

Hoping my rpi shows up soon so I can bring many of the gles ports ive worked on.

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

Re: Using openGL?

Thu Apr 26, 2012 2:31 pm

but X windows running on pi doesn't support gl yet, so its full screen or nothing?

(which is fine by me.. just pointing it out)
Pi Status > Farnell, Arrived 24/5- RS, Arrived 1/6

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

Re: Using openGL?

Thu Apr 26, 2012 2:57 pm

OpenGL-ES renders to a EGL surface which can be a basic framebuffer or a X window (fullscreen or windowed). There is nothing that needs to change in X windows.

I think your confusing what GLX does for OpenGL on the desktop. This is replaced by EGL.

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

Re: Using openGL?

Thu Apr 26, 2012 3:43 pm

nah it was an based on a post here

shirro said:


There is no 2D acceleration for X or a glx OpenGL extension for X.

You will be running gles2 programs full screen independent of X.


(source : http://www.raspberrypi.org/for.....8;search=2 )

but i believe suggestion that windowed support is possible, but a PITA is here : http://www.raspberrypi.org/for.....-questions

i understand that egl may only need a framebuffer region to render into without x supporting gl/glx/.
Pi Status > Farnell, Arrived 24/5- RS, Arrived 1/6

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

Re: Using openGL?

Thu Apr 26, 2012 5:01 pm

All of those statements are from a GLX standpoint, and not considering EGL. As long as there are no issues within the EGL driver itself it should be able to support getting a X window surface and use it for the rendering.

The statement that there is no 2D acceleration of the X is correct, but that doesnt prevent you from rendering to it.

I primarily play around with the Pandora for my development. We run standard X (xfce window mangement) with the powervr SGX driver. I use SDL to setup the X window, then i give the reference to the window to EGL. Now all my OpenGL-ES rendering is applied to my window. And my window can be fullscreen or a window on the desktop.

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 Apr 26, 2012 7:13 pm

Based on the limiited experience I've had on a Pi in the UK using VNC and ssh remotely from California, I don't see how anything useful is going to be possible with ES in an X window (it's singular ) environment given the positively anemic resources available on the Pi, particularly RAM, and especially with half of it dedicated to the GPU.  Watch the performance meter in LXDE after a screensaver has been running - anything more complex than colored rectangles pretty much pegs it, although that may be due to everything currently running without GPU acceleration in X.

For what we want to do in Pi-finity! it seems that our only option is going to be rendering directly to a framebuffer, as we're not going to be able afford RAM being dedicated to anything else like EGL, etc., much less X.  That's OK, it will be an immersive environment and all of the interaction will be through things like simulated spacecraft/aircraft/vehicle/computer instrument panels and exterior windows/viewports, as well as keyboard and mouse/trackpad input for movement and actions by simulated individual characters.

We really won't know what we'll be able to do until all of the various pieces are in place, such as GPU-accelerated X, ES integrated into Python, etc., but, my going-in position is now that we're going to have to judiciously marshal every byte and CPU cycle if we plan to do anything more exotic than editing text and producing static images.  That's actually a good thing for students to learn, not to mention engineers who have grown up in a land of plenty over the last decade, or so, where the answer to everything was just throw more instructions per second, RAM, storage space, network bandwidth, etc., at the problem.
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!!!

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

Re: Using openGL?

Fri Apr 27, 2012 8:55 am

As someone who is an opengl programmer my only real worry is running hi res with 256MB of ram, I think that will be a challenge when you start to use fairly complex models and textures.

Can any one tell me who has a pi are people running opengl graphics on SDL or using something like open framebuffer?

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

Re: Using openGL?

Fri Apr 27, 2012 9:33 am

Pickle said:


All of those statements are from a GLX standpoint, and not considering EGL. As long as there are no issues within the EGL driver itself it should be able to support getting a X window surface and use it for the rendering.


On my imx53 I have two set of graphics libs. One lot is linked to X11 and the other only works with the framebuffer. The Raspberry Pi's "native window system" for EGL is something called dispman and if you look at the EGL library you can see it isn't linked to any X windows libs.

Unlike the X11 version of the libs on my mx53 quick start board both the broadcom and the mx53 framebuffer pass EGL_DEFAULT_DISPLAY to eglGetDisplay. Under X11 you would pass the X display.

You can't pass an X11 window as the third parameter to eglCreateWindowSurface. I believe you have to pass it a structure as shown in the hello_triangle.c demo after using some proprietary broadcom functions to init the display and setup dispman and get height and width etc. On my mx53 with the framebuffer libs I have to pass it a file descriptor created by opening /dev/fb0.

The windowing system in EGL seems to be left up to the vendor. Once initialised hopefully it all works the same.

I will be adding lots of #ifdefs to my play code so hopefully it will work with Mesa, two ways on my imx and on the Pi.

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?

Fri Apr 27, 2012 10:40 am

@shirro Correct. The EGL native window type is dispmanx, not X.
The framebuffer (and so X) is a dispmanx layer.
You can create EGL surfaces that are in front of, or behind (visible through transparent parts) the framebuffer, and these can be rectangles that are not full screen.
However they will not interact with X until X utilising GL ES composition comes along.
(X utilising dispmanx for composition could be possible, but I think GL ES has more promise).

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

Re: Using openGL?

Fri Apr 27, 2012 1:17 pm

@shirro I posted the code to use SDL(X11) with EGL. It has worked on Intel Mesa and Powervr SGX. I can post code using X11 with EGL too if needed. If you or anyone has a Pi, id be interested on what it does when run.

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

Re: Using openGL?

Fri Apr 27, 2012 3:00 pm

@Pickle, It wouldn't take much work. I might give it a go on the mx53 actually because I am pretty sure it would work there for X11 and the Pandora stuff is almost exactly what is needed if run on the mx53's framebuffer.

For the Pi you would need to include bcm_host.h and in Platform_Open you would want to do bcm_host_init() , open dispmax, add an element and then use the handle from that as part of a struct to provide your g_Window.

Check out this example:

https://github.com/raspberrypi/firmware ... triangle.c

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?

Sat Apr 28, 2012 4:16 pm

OK, so, I did the make to get hello_triangle.bin (which required a make clean, first, BTW).  Looking at the links provided to earlier discussions in other threads mentioned earlier here, it is reportedly possible to render to a window in X.  I'm running remotely over VNC from 5,424 miles away, so, I can't see rendering outside the X desktop.  Has anyone modified hello_triangle.c so that it will render to a window in X, yet?

So close, and yet so far ... literally
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: 5286
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Using openGL?

Sat Apr 28, 2012 4:41 pm

No, you cannot render with openGL ES to an X window.

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?

Sat Apr 28, 2012 5:10 pm

dom said:


No, you cannot render with openGL ES to an X window.


So, we're back to waiting for a GPU-accelerated X server?  I wonder which will take longer - the accelerated X server, delivering a Pi to my door, or a very hot place becoming very cold?  I'm beginning to think my money needs to be moved to a spot on the roulette table closer to "You're getting colder"
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: 5286
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Using openGL?

Sat Apr 28, 2012 5:29 pm

I don't really see what you need OpenGL ES in an X window for.

You are already going to severely limited in (ARM) processing and memory. Especially if you are doing complex things with 3D hardware and probably need the 128M ARM split.

You can launch from X, and have X shutdown and your game running in seconds. When your game quits, X can be relaunched. asb has done this for launching Quake in the press image and it works well.

I expect there will be openGL ES accelerated X in some months time, and that will allow openGL ES in X windows, however even then, you would be advised to run games full screen, with X shut down. Running a 3D game alongside a web browser in X is not realistic on R-Pi.

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

Re: Using openGL?

Sat Apr 28, 2012 6:07 pm

Jim Manley said:


dom said:


No, you cannot render with openGL ES to an X window.


So, we're back to waiting for a GPU-accelerated X server?  I wonder which will take longer - the accelerated X server, delivering a Pi to my door, or a very hot place becoming very cold?  I'm beginning to think my money needs to be moved to a spot on the roulette table closer to "You're getting colder"



My Pi is due to be delivered "w/c May 7th" and I'm testing my EXA-accelerated fbdev X server and associated kernel module *right now* on x86. I spent the last four hours getting Xorg 7.6 to cross-compile for ARM.

(speaking of which...it finally linked!)


hw/xfree86/Xorg: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.31, BuildID[sha1]=0xf30e0de56374d73df30ce835beff6c12f92dc2cd, not stripped


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?

Sat Apr 28, 2012 8:09 pm

What do you not understand about the distance of 5,424 miles I'm forced to be separated from actual hardware for an indeterminate period of time while I'm trying to do development?  I can't see what's happening outside of X, so, I can't see anything sent directly to the framebuffer.

Given all of the other "unfortunate events" associated with this project up to this point, I can't afford to believe any more claims that things will work just fine.  I need to see what I'm doing with code executing on the hardware to make sure the display looks as expected, particularly within the constraints of the hardware.  I've made it abundantly clear that the vast majority of what I will be doing will be executing on the GPU, and I've demonstrated in WebGL that I know what I'm doing, since that uses essentially the same GL techniques as those needed for ES.

As I've already stated, eventually, the entire Pi-finity! software suite will be running full-screen, but, all I want to do for now is run bits, pieces, and stubs in whatever mode I can access remotely.  Based on the latest vague reports from the distributors, it appears I'm at least a third or fourth month away from receiving a board beyond the original "for-sure" date when availability was supposed to occur (which was four months beyond the original estimate of hardware availability to developers).  We have to be able to do at least a modicum of time and other resource planning, especially since we're trying to do this on top of already-overloaded schedules for work that keeps us fed, dry, and slightly less cranky than we otherwise would be.

Such comments precisely reflect the lack of comprehension of what frustrated developers are having to do to get things done under very disappointing circumstances.  They also reflect how priorities have not been aligned so that there will be the kinds of eye-popping software available sooner that is critically needed to differentiate the Pi from the crowd of ho-hum, yet-another-computer systems.  The misalignment is also impeding the work to adequately document how students can create their own impressive software, which is my primary goal.  Just tossing out URLs to pages with upwards of hundreds of links to code that won't actually run on the Pi is not going to win any young fans who are already being distracted by game consoles, mobile devices, and everything else with billions of dollars of flashy marketing behind them.

I still have high hopes that I'll be able to get some really great software running on the Pi that will make it even more popular than it already is, sight unseen.  The situation reminds me of the comic from "The Far Side", where a pair of vultures are watching some poor soul crawling across a parched desert, and one vulture says to the other, "Patience my ass, I'm gonna kill somethin'."  I am in no way advocating violence against any poor souls crawling across deserts, I just love the warped humor of Gary Larson.

Well, I guess now that I can't make any progress on GPU-oriented software, I have no excuse for not concentrating on the peer-to-peer experiments.  However, that means I need to sweet-talk at least one more lucky stiff with a Pi to allow me to invade their board to install and test a Pi-finity! P2P transponder (not the same as a file-sharing P2P client such as bit-torrent software, but, it's based on some of the same principles and code fragments).

I suppose things could be worse, and it was Monday instead of Saturday
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?

Sat Apr 28, 2012 8:33 pm

teh_orph said:


I'm testing my EXA-accelerated fbdev X server and associated kernel module *right now* on x86. I spent the last four hours getting Xorg 7.6 to cross-compile for ARM.

(speaking of which...it finally linked!)

hw/xfree86/Xorg: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.31, BuildID[sha1]=0xf30e0de56374d73df30ce835beff6c12f92dc2cd, not stripped


That's really great news!  Now I only feel half as grumpy as I was a few minutes ago.  At this rate, Liz and Eben will be showing up at my door tomorrow with not one, but a crate of Pi boards after getting extremely lost in SoCal and accidentally wandering up North to here.  Oh, just let an old man do the geek equivalent of wistfully lusting after a beautiful woman, will ya?
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: 5286
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Using openGL?

Sat Apr 28, 2012 9:29 pm

@Jim With no (local) Pi, I'd recommend doing most development on Windows/linux PC with GL ES libraries.

On the remote Pi, you can time each frame, and use glReadPixels to dump the framebuffer out to check everything is working correctly.

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

Re: Using openGL?

Sat Apr 28, 2012 10:17 pm

just what I was going to say and bang in line with where i"m at today too.

i"ve been thinking about my projects/engine etc long enough.

this evening i"ve installed visual studio on my itunes/email laptop whilst watching the voice/bgt etc..  (as we moved house not long ago my desktop machine is still in a box until i"ve converted the garage) and can fiddle with code a bit in the evenings when being "forced" to watching eastenders and the like.

i"m stuck though.. the mobile ati drivers on my vaio (which support gl 3.2) aren"t new enough to have the inbuilt ES stuff (i"ve checked for updates too), so there"s either a choice between the following

the powervr emulator : http://www.imgtec.com/powervr/...../index.asp

mali dev emulator: http://www.malideveloper.com/o.....ulator.php which says it layers over normal gl

http://code.google.com/p/angleproject/ which emulates OpenGL ES 2.0 on top of DirectX 9.

i think there are more too..

this free app shows what extensions your card supports http://www.realtech-vr.com/glview/

some good info here too  > http://soulbuzz.net/?p=225

i've just installed the mali one, and have built the cube sample that comes with the emulator from the cmdline ok, so it looks like i'm set! - took about 5mins
Pi Status > Farnell, Arrived 24/5- RS, Arrived 1/6

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 4:28 am

dom said:


@Jim With no (local) Pi, I'd recommend doing most development on Windows/linux PC with GL ES libraries.

On the remote Pi, you can time each frame, and use glReadPixels to dump the framebuffer out to check everything is working correctly.


@dom – I can and do develop with OpenGL (including ES) on desktops/laptops, but, that doesnt provide an environment matching the unique, varied mix of resources on the Pi (700 MHz ARM CPU and miniscule split-CPU/GPU RAM, yet 24 GFLOPS GPU and 1080p HDMI output).  I need to determine experimentally what mix of concurrent processes the hardware can actually support producing continuously-changing animated scenes driven by real-time user input, so, individual frames wont hack it (so to speak).

There are network components that also have to be figured into the mix, which obviously have to run on the CPU along with user interaction, housekeeping functions, etc., etc., etc.  I've already produced bits of pieces of these on other platforms to test basic functionality, but, I won't be able to test their integration performance-wise until Ive got a board, and I really need a number of boards talking to each other to test things adequately.  I don't want to develop a bunch of code that just won't fit within the Pi's constraints.  I can't even run code profiling tools on the Pi because of their resources impact.

Some of the challenges are a result of mainstream software development going down the path of gobbling up ever-more resources.  I have the same problem in high-performance computing work I do, where there literally is no way to replicate the hardware environment adequately, and it's even tougher when I'm coordinating the work of upwards of hundreds of thousands of processors.  Some of that involves visual output, too, and if the computations can't be done in a reasonable amount of time, there's no visual output.

Just when I think I have all the answers, they change all the questions
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?

Sun Apr 29, 2012 7:31 am

Is it possible to generate an H.264 stream over the network based on the framebuffer output?  Obviously, it would be ideal if the compression/sampling can automatically be adjusted based on feedback from the receiving client as to how much of the stream is getting through compared with what a successfully-received full stream would be.

An acceptable alternative would be directing/copying such a stream into a file on the Pi, which could then be transferred in-toto without any loss as network bandwidth allowed.  Of course, this wouldn't allow for real-time interaction, but, it would still be useful.

Is the framebuffer in the RAM assigned to the GPU at boot-up, or is it contained within the GPU or circuitry between the GPU and HDMI port?  Any code examples that show how to access the framebuffer for routing its contents elsewhere beyond the HDMI port would be extremely useful.
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 7:41 am

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.

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 Linux OpenGL 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/
Pi Status > Farnell, Arrived 24/5- RS, Arrived 1/6

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

Re: Using openGL?

Sun Apr 29, 2012 11:54 am

Does the OpenGL ES 2 implementation on the Pi not have a shader compiler?

[Sorry, I feel really stupid for even asking that question. But shaders don't seem to be compiling for me and there is nothing in the error log so I got the value of GL_SHADER_COMPILER and now I am confused.]

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

Re: Using openGL?

Sun Apr 29, 2012 12:05 pm

"Raspberry Pi, Qt 5, QML, Shaders "



?
Pi Status > Farnell, Arrived 24/5- RS, Arrived 1/6

Return to “General discussion”