AllegroGL and BITMAP
mscava

I'm playing a bit with AllegroGL. And I'm confused with one thing...

BITMAP* bmp = create_video_bitmap( 64, 64 );
GLuint texture = allegro_gl_make_texture( bmp );

What exactly get's done by allegro_gl_make_texture? Can I call destroy_bitmap( bmp ) now, because texture was sent to GPU? Do I even need to call create_video_bitmap? What would changed if I called create_bitmap?

vbovio

allegro_gl_make_texture will create a texture from your bitmap, it does some checking though, try looking at the source to see it (..\alleggl-0.4.0\src\texture.c), but basically does that. I'm almost sure it is safe to destry your bitmap afterwards, and yes, you can use create_bitmap.

Archon
Quote:

What would changed if I called create_bitmap?

I thought that using create_bitmap was the norm? Theres no real point (AFAIK) on using video bitmaps just to make an OpenGL texture.

Quote:

Can I call destroy_bitmap( bmp ) now, because texture was sent to GPU?

Yes - it is not needed anymore.

Mr. Big

As mentioned above, using video bitmaps is pointless in your case, and the bitmaps are safe to delete after they're sent to the graphics card...

mscava

Thanks. I've found it out in the source that BITMAP must be memory. Well and I'm trying to create some kind of Bitmap class where I'd merge AllegroGL and Allegro... The only problem is that the memory for Bitmap will be allocated twice, becuase when I want to edit the texture I'll have to draw onto Allegro's one and create GL texture again... But at least I'm not confused now.. Thanks

Milan Mimica

When the display driver is GFX_OPENGL, create_video_bitmap() creates a BITMAP* built upon a OpenGL texture. Drawing such a BITMAP* to the 'screen' BITMAP* will be extremely fast (well, in theory). The only thing is that this wrapper thing is still unfinished and only blit(), masked_blit(), draw_sprite() and draw_trans_sprite() are available.
No point merging AllegroGL and Allegro since AllegroGL does it already, or at least it tries.

mscava
Quote:

When the display driver is GFX_OPENGL, create_video_bitmap() creates a BITMAP* built upon a OpenGL texture. Drawing such a BITMAP* to the 'screen' BITMAP* will be extremely fast (well, in theory). The only thing is that this wrapper thing is still unfinished and only blit(), masked_blit(), draw_sprite() and draw_trans_sprite() are available.
No point merging AllegroGL and Allegro since AllegroGL does it already, or at least it tries.

Nice to know... I'll try to look on it a bit!

Milan Mimica

src/videovtb.c and src/glvtable.c

Get it from the SVN because there were some changes.

Thread #589876. Printed from Allegro.cc