VPU/GPU video in a texture
Kev Callahan

Hi,

I'm currently messing around with (rpi) OPENGLES and Allegro 5 in order to display video.

Problem I have (not really a problem but would be a 'nice to have') is that I have an OPENGL texture id for the video buffer that is filled by the VPU and I can display it directly using OPENGL glDrawArrays() call and it's working ok.

However, what would be nice is to create an ALLEGRO_BITMAP linked to the existing OPENGL texture id for the buffer (already created using eglCreateImageKHR()).

Is there any simple way to create an ALLEGRO_BITMAP directly linked to an existing texture?
I know I could create an ALLEGRO_BITMAP and then copy one to the other but I would like a more optimal setup..

Kev

Polybios

It's not possible to do it this way directly, I think.
However, you could do it the other way round: Just create an Allegro bitmap at the start and use its texture id to render into.
You can retrieve its texture id via al_get_opengl_texture. Also see the functions below that.

Kev Callahan

Unfortunately I think I need to use eglCreateImageKHR() directly to create the texture available to the VPU, other methods I tried failed (ie using al_create_bitmap( )and using al_get_opengl_texture()).

I could very well be wrong though and if anyone has any insight I'm keen to listen if they've had success in this area.

Polybios

Ok, I see how much I don't know. :P
From reading a bit it seems that this stuff uses its own OpenGL texture target GL_TEXTURE_EXTERNAL_OES, so I'd say it's not really compatible. However, I don't really know.
You could probably use FBOs for copying, though.

Kev Callahan

;D,.. Thanks :)
I'll look into how quickly I can copy from one to another but think it's not optimal.
Maybe I'll do what I've done elsewhere and try to combine my allegro 5 2d stuff with the opengl 3d stuff is there's not any other way...

EDIT:
Out of interest I tried adding
al_set_opengl_texture(ALLEGRO_BITMAP *, GLuint)
to my Allegro build (ogl_bitmap.c)

It sort of works although the texture is upside down and starts halfway through..
So more work/investigation required..

The ALLEGRO_BITMAP size is 1920x1080 but the OPENGL bitmap is (obviously) rounded up to 2048x2048, so maybe I have to work around that...

Edgar Reynaldo

That's cool. Interested to see your progress. ;)

Kev Callahan

once I get things going properly I'll share it all as per usual :)

Thread #616967. Printed from Allegro.cc