Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » AllegroGL and file_select_ex

This thread is locked; no one can reply to it. rss feed Print
AllegroGL and file_select_ex
James Bunting
Member #30
April 2000
avatar

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?

James

1allegro_gl_set_allegro_mode();
2w = SCREEN_W - 50;
3h = SCREEN_H - 50;
4 
5if( w < 310)
6 w = 310;
7 
8if( h < 195)
9 h = 195;
10 
11result = file_select_ex( msg, filename, ext, 768, w, h);
12 
13clear_keybuf();
14 
15allegro_gl_unset_allergo_mode();

Bob
Free Market Evangelist
September 2000
avatar

Can you post a screenshot of what you see?

--
- Bob
[ -- All my signature links are 404 -- ]

Kitty Cat
Member #2,815
October 2002
avatar

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:

glDrawBuffer(GL_FRONT);
glReadBuffer(GL_FRONT);
result = file_select_ex( msg, filename, ext, 768, w, h);
glDrawBuffer(GL_BACK);
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.

--
"Do not meddle in the affairs of cats, for they are subtle and will pee on your computer." -- Bruce Graham

Bob
Free Market Evangelist
September 2000
avatar

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 :(

--
- Bob
[ -- All my signature links are 404 -- ]

Niunio
Member #1,975
March 2002
avatar

You didn't read this, did you?

-----------------
Current projects: Allegro.pas | MinGRo

James Bunting
Member #30
April 2000
avatar

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.

James

Go to: