Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Allegro 5 on RPi - All working, but some questions

This thread is locked; no one can reply to it. rss feed Print
Allegro 5 on RPi - All working, but some questions
Kev Callahan
Member #6,022
July 2005
avatar

Hi,

I've just started developing with Allegro 5 on the Raspberry Pi..

Great framerates so far and pleased with what's possible with HW acceleration enabled.

Is it worth trying to get OpenGLES bits working from within Allegro (something I haven't managed to get working yet - ie OPENGLES programs work or Allegro works - haven't figured out what needs to be setup to mix the two).

Kev

Thomas Fjellstrom
Member #476
June 2000
avatar

GL/GLES and Allegro are possible to use at the "same time". Allegro gfx apis assume they are in control of the GL state, so you may want to save state before changing things, then restore it before calling allegro drawing functions.

If you don't use any allegro drawing, and just use GL, like your own shaders, and VBOs, then just use GL as you see fit.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Kev Callahan
Member #6,022
July 2005
avatar

Ah thanks Thomas..

You are implying it's not a common thing to do then..?

Must admit the more I look at OpenGL(ES) the more I am shying away from using it - although what's possible from demos is making me think I need to read up more to understand the basics(!).

Thomas Fjellstrom
Member #476
June 2000
avatar

You are implying it's not a common thing to do then..?

It's quite common to treat Allegro5 as a window creation and event api, and use GL directly for drawing.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Trent Gamblin
Member #261
April 2000
avatar

I guess you want to get OpenGL ES working instead of regular OpenGL? I'm not sure if there is any benefit but if there is that would be worthwhile. Could you elaborate maybe?

Kev Callahan
Member #6,022
July 2005
avatar

Trent Gamblin
Member #261
April 2000
avatar

Ok you're right, but I still don't understand your question. Allegro uses OpenGL ES on Pi, so if Allegro works OpenGL ES works too.

Kev Callahan
Member #6,022
July 2005
avatar

I was trying to access the opengles api as well as the Allegro api (and trying to figure out if it's worth looking at).
I've always preferred using Allegro but imagine there are things available via opengles direct that I can't do with Allegro..?

eg -
An example would be (say) the opengles spinning teapot with video mapped onto the surface: http://www.raspberrypi.org/documentation/usage/demos/hello-teapot.md

Could this be done just using the A5 API..?
If so then endeavouring to access the opengles layer are pointless (and that would be great). :)

Trent Gamblin
Member #261
April 2000
avatar

You can draw in 3D with the primitives addon and Allegro 5 transformations. But there are some things you may need to access directly. I would look at ex_opengl in the A5 source which you should have compiled (unless they don't get compiled on RPi, and I can't remember.) Basically you just include OpenGL or OpenGL ES headers then use GL wherever you want. I think on RPi the OGL headers are:

#include <GLES/gl.h>

And you may need (but probably not):

#include <EGL/egl.h>
#include <EGL/eglext.h>

Those headers I believe are located in /opt somewhere so you need to tell your compiler to use that directory (-I/opt/vc/include).

EDIT: allegro_opengl.h already includes the correct headers, so just include that. You'll still have to add the search path though.

Kev Callahan
Member #6,022
July 2005
avatar

Ah cheers Trent - will take a look at that.

I believe ex_opengl doesn't build (or can't be built - maybe I'll look at that code, but it probably I guess has OPENGL specific functions that aren't available in ES).

I will take a closer look at the Primitives addon - only currently used that for drawing rectangles, would it support 'mapping a texture onto a triangle' for example.

Thomas Fjellstrom
Member #476
June 2000
avatar

would it support 'mapping a texture onto a triangle' for example.

Yup. It can do a lot more than that if you work with the lower level stuff as well. And if you throw in shaders, you can do anything.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

pkrcel
Member #14,001
February 2012

Someone even made some decent 3D in the latest speedhack :)

It is unlikely that Google shares your distaste for capitalism. - Derezo
If one had the eternity of time, one would do things later. - Johan Halmén

Kev Callahan
Member #6,022
July 2005
avatar

Go to: