|
Changing from pure allegro to OpenLayer in one program |
Vasco Freitas
Member #6,904
February 2006
|
I want to use file_select_ex() (for selecting a file) at the very beggining of my program, then use OpenLayer for the main program, and call file_select_ex() again at the end. Before using file_select_ex() I have to call allegro_init(), install_keyboard() and set_gfx_mode(), but if I do that OpenLayer doesn't work. Is there a way to do this? I basically just want an easy way to have a simple file browser at the beginning and end of my program. |
Hrvoje Ban
Member #4,537
April 2004
|
Quote: but if I do that OpenLayer doesn't work How, did SetupProgram / SetupScreen failed or something else? Anyway you could try adding allegro_exit before OpenLayer initialization. |
juvinious
Member #5,145
October 2004
|
Um OpenLayer initializes allegro for you. Why don't you just init openlayer and use your allegro commands like normal? __________________________________________ |
Richard Phipps
Member #1,632
November 2001
|
Setting up OpenLayer (which sets up allegro too) first is probably what you want to do. It's possible (although unlikely) that file_select_ex draws to the normal Allegro 'screen' and OpenLayer only sets up a basic OpenGL screen. You'll probably need to do a few AllegroGL calls if OpenLayer doesn't do them to let you use the 'screen' in this case. |
Vasco Freitas
Member #6,904
February 2006
|
Hrvoje Ban said: How, did SetupProgram / SetupScreen failed or something else? Anyway you could try adding allegro_exit before OpenLayer initialization. It crashes at Setup::SetupScreen(). Adding allegro_exit() before OpenLayer initialization worked Now I just need a way to "exit" OpenLayer before the end of the program... juvinious said: Um OpenLayer initializes allegro for you. Why don't you just init openlayer and use your allegro commands like normal? The allegro file window doesn't appear. Richard Phipps said: It's possible (although unlikely) that file_select_ex draws to the normal Allegro 'screen' and OpenLayer only sets up a basic OpenGL screen. This is probably what happens... |
Richard Phipps
Member #1,632
November 2001
|
If you just do the normal OpenLayer setup and don't initialise Allegro or an allegro screen, what happens? |
Vasco Freitas
Member #6,904
February 2006
|
Like I said, the file window doesn't appear. I just get a black screen. |
Steve Terry
Member #1,989
March 2002
|
Quote: Like I said, the file window doesn't appear. I just get a black screen. That's normal, OpenLayer uses an OpenGL surface, not an allegro one, unless you do some other steps to get the file selection to show on an opengl surface you will never see it. OpenGL needs to flip the buffer anyway if you want to see anything. ___________________________________ |
Vasco Freitas
Member #6,904
February 2006
|
Well, is there a way to "shut down" OpenLayer then, so I can use just allegro at the end of the program? |
Thomas Fjellstrom
Member #476
June 2000
|
I believe AllegroGL (which OpenLayer uses) has methods that allow you to use allegro GUIs. -- |
Hrvoje Ban
Member #4,537
April 2004
|
Try this: ol::Setup::SetupProgram(); set_gfx_mode(GFX_AUTODETECT_*, ...); file_select_ex(...); set_gfx_mode(GFX_TEXT, 0, 0, 0, 0); // Remove graphic mode ol::Setup::SetupScreen(...); /* ... */ set_gfx_mode(GFX_TEXT, 0, 0, 0, ); set_gfx_mode(GFX_AUTODETECT_*, ...); file_select_ex(...)
|
Vasco Freitas
Member #6,904
February 2006
|
Hrvoje Ban said: (...) It crashes at the third line: file_select_ex(...); EDIT: Thomas Fjellstrom said: I believe AllegroGL (which OpenLayer uses) has methods that allow you to use allegro GUIs. It has some methods that correspond to allegro GUI functions, but file_select_ex() isn't one of them. I also tried remove_allegro_gl(), allegro_gl_set_allegro_mode() and allegro_gl_unset_allegro_mode without success. Isn't there a function that just "undoes" OpenLayer initializations? That would be enough. |
juvinious
Member #5,145
October 2004
|
Quote: The allegro file window doesn't appear.
Ah I didn't know you were using gui functions. :| __________________________________________ |
Vasco Freitas
Member #6,904
February 2006
|
Like I said, it supports some GUI functions but not file_select_ex() |
Hrvoje Ban
Member #4,537
April 2004
|
I made small example that works:
You need to remove AllegroGL so set_gfx_mode can succeed and re-install it again before setting up OpenLayer screen. Hackish, but it's best I could come up unless AllegroGL has some way to render Allegro GUI. |
Vasco Freitas
Member #6,904
February 2006
|
Thank you! That did the trick |
|