AllegroGL and file_select_ex
James Bunting

I am trying to use an Allegro file select box within AllegroGL by popping in and out of "allegro mode" before and afterwards.

The dialog is not drawn to the screen at all even though it is working (I can press the correct keys to make it work!).

Here is a snippet, any ideas, can it be done?


2w = SCREEN_W - 50;
3h = SCREEN_H - 50;
5if( w < 310)
6 w = 310;
8if( h < 195)
9 h = 195;
11result = file_select_ex( msg, filename, ext, 768, w, h);


Can you post a screenshot of what you see?

Kitty Cat

AllegroGL's "screen" is normally an off-screen buffer that needs to be flipped. Allegro's GUI doesn't know about this so all changes to the screen go by un-noticed. To fix it, you can try this:

result = file_select_ex( msg, filename, ext, 768, w, h);
glReadBuffer(GL_BACK); // not sure here.. Bob?

That should make AllegroGL draw directly to the screen so you don't need to flip to see the changes.


This sounds like we need a page flip vtable entry and make all blocking Allegro functions call it...

Edit: No wait, that won't work either :(


You didn't read this, did you?

James Bunting

It does not draw at all, if I render a scene or clear the screen then I simply get whatever is there.

Thanks for the link, I did read that part of the AllegroGL docs but was hoping that by calling allegro_gl_set_allegro_mode() I could just use good old Allegro routines. The program's behavious and comments here suggest that this will never work without the internal flipping.

Natuarlly the way to get this working is to process a file select dialog manually using algl_do_dialog. Amazingly I have little experience with the Allegro GUI as I tend to write my own (apart from the file selector as it is quite complex). I have already created a pretty comprehensive GUI for my OpenGL map editor which includes icon toolbars and drop down menus etc (using an orthoscopic matrix).

Well I will hunt around for an example of algl_do_dialog (exdialog.c), hopefully I can still use the Allegro file select dialog with this function.


Thread #586297. Printed from