Leander
Posts: 3
Joined: Fri Jan 20, 2012 1:03 pm

Re: GPU Related Questions

Fri Jan 20, 2012 1:24 pm

Hello.

I'm very interested in the Raspberry Pi from a developers perspective. One of my main interests is the platform is its GPU capabilities. I've been trying to figure out if there is any support for accelerated compositing and access to the OpenGL ES 2 API directly after the operating system has been installed.

From what i could tell from my forum searches so far, is that OpenGL ES 2 will be available directly from start. Right?

A more technical question i have is if it'll be possible to run an OpenGL ES application without any X server and to control what memory is assigned to the GPU and which is assigned to the operating system?

Regards,

Leander

p.s.: Please forgive me if this topic has already been discussed before.


theHetman
Posts: 88
Joined: Tue Jan 10, 2012 5:42 pm

Re: GPU Related Questions

Fri Jan 20, 2012 4:41 pm

As I understand it the OpenGL API is available to applications running from the shell.  All the demos that I have seen that use the GPU (Quake III, movie playback, Airplay) have been run from the command line and I believe (although I could be wrong) that OpenGL is not currently available to applications running under a GUI.

Certainly there are no GPU accelerated X Windows drivers yet.  There is a current thread about that here.

So you will be able to write programs that use OpenGL without running X.  As for video memory allocation.  Memory is shared with the rest of the system.  I've read that the GPU is able to specifly how much RAM is used for graphics but I'm unsure if you will be able to change the amount used through the drivers.  I believe that 64MB is asigned to the GPU on the model "B" but I'm not sure if the model "A" will be the same.

User avatar
Redrobes
Posts: 80
Joined: Mon Dec 26, 2011 9:19 pm
Location: S.W. UK
Contact: Website

Re: GPU Related Questions

Fri Jan 20, 2012 6:59 pm

Assuming that you have to launch the app from the command line without X, does anyone have any links to boilerplate C/C++ code for starting up full screen and getting an accelerated OpenGL context / simple demo that we could start to expand upon ? I wouldn't  want to hack down an RPi port of Quake to almost nothing just to get a working base

Leander
Posts: 3
Joined: Fri Jan 20, 2012 1:03 pm

Re: GPU Related Questions

Fri Jan 20, 2012 7:17 pm

theHetman said:


As I understand it the OpenGL API is available to applications running from the shell.  All the demos that I have seen that use the GPU (Quake III, movie playback, Airplay) have been run from the command line and I believe (although I could be wrong) that OpenGL is not currently available to applications running under a GUI.

Certainly there are no GPU accelerated X Windows drivers yet.  There is a current thread about that here.

So you will be able to write programs that use OpenGL without running X.  As for video memory allocation.  Memory is shared with the rest of the system.  I've read that the GPU is able to specifly how much RAM is used for graphics but I'm unsure if you will be able to change the amount used through the drivers.  I believe that 64MB is asigned to the GPU on the model "B" but I'm not sure if the model "A" will be the same.


Thanks for the reply, that was just the information i was looking for!

I would also be interested in knowing exactly how to setup the EGL context from the command line.

Tomo2k
Posts: 127
Joined: Mon Dec 19, 2011 10:00 pm

Re: GPU Related Questions

Sat Jan 21, 2012 10:47 pm

You won't set up an OpenGL context from a command line, it will be part of your program - whether run from the command line or from the windowed desktop.

It also doesn't matter whether you run from a GUI or not to get hardware acceleration.
(Though "windowed" acceleration may be harder to sort out than fullscreen.)

For example boilerplate code, do a web search for "OpenGL ES tutorials" and "OpenGL tutorials" – OpenGL ES is a subset of OpenGL 'proper' so most of it it the same, just a few features that are unavailable to the smaller devices.

The "GLUT" library is a good place to start as well.

http://www.opengl.org/code/

Finally, the Qt framework has a lot of examples of using the Qt framework for OpenGL and OpenGL ES and is known to support the RPi already.

http://developer.qt.nokia.com/.....gl-es.html

User avatar
Redrobes
Posts: 80
Joined: Mon Dec 26, 2011 9:19 pm
Location: S.W. UK
Contact: Website

Re: GPU Related Questions

Sun Jan 22, 2012 12:29 am

The point of this thread is that an assertion has been made that you can't run OpenGL ES from a window since there is no accelerated X driver yet. Ok maybe there is something for Qt but the thread is saying that your app does need to be a shell app if it is to get an accelerated OpenGL context. I know the context is part of the app - I have written dozens of OpenGL apps. I know about OpenGL but I don't know about the environment required to get me the OpenGL context started on an RPi.

In Windows you can get a context which is a software implementation of OpenGL and you must ask for it to be hardware accelerated or not at the context creation time. I would assume with an RPi that you have only accelerated contexts or you dont get one at all but I dont know that for sure. In linux land I believe that the software implementation is Mesa but I think you would need to include libraries etc so its not like you might get that by accident. But if the assertion is correct then it is saying that under a windowed app (running X windows) that when you ask for an OpenGL context it will deny you since at mo there is no accelerated X driver.

Using OpenGL when you already have the draw canvas and the GL context is not an issue and should be like programming OpenGL with any other ES 2.0 environment.

GLUT may help but I would imagine that it would be, by default, layered on top of X. I.e. my hunch is that it would be no good. I heard that RPi is supporting SDL as well as Qt but I could do with more info really. I believe SDL can start OpenGL as well. Anyone confirm SDL on Rpi ? Is there a GLUT for SDL on RPi ?

But linux is not my forte so if anyone can shed light on how RPi demos, specifically, are getting GL then do shout.

User avatar
Redrobes
Posts: 80
Joined: Mon Dec 26, 2011 9:19 pm
Location: S.W. UK
Contact: Website

Re: GPU Related Questions

Sun Jan 22, 2012 1:40 am

This link is confirming that you can start it with Qt:

http://labs.qt.nokia.com/2011/.....ted-qt-pi/

and Wikipedia quotes that XBMC (which has been announced recently on RPi):

"...partially uses SDL (Simple DirectMedia Layer) multimedia framework and OpenGL graphics rendering under XBMC for Linux".

I am guessing that this implies that you can get to OpenGL from SDL on an RPi and that they didn't do something insane like port any of the windowing to Qt first.

Ok so when I get a board ill start by looking to the SDL route.

Return to “General discussion”