![]() |
|
Allegro 5 and OpenGL |
crexalbo
Member #15,035
April 2013
|
I have a monolithic static-link library build of Allegro 5.0.8 that i have been using to code for a while now. I am doing my testing on Windows but am hoping to port my application to OSX and Linux when finished. I'm just trying to figure out: 1) How do i get OpenGL to work with an Allegro window? (source code, library linkage) I've been poking around the Allegro sites for a few days and haven't found anything of use. |
Thomas Fjellstrom
Member #476
June 2000
![]() |
Allegro supports OpenGL on all of its platforms. Even windows. If you don't use OpenGL yourself, you don't need to care about setting it up, allegro will do that for you. -- |
Arthur Kalliokoski
Second in Command
February 2005
![]() |
By coincidence I was just messing around with monolithic static-link for an A5 program. These were all required on the Slackware 14.1 I just installed a couple weeks ago. -lvorbisfile -lvorbis -lFLAC -lpng -ljpeg -lgtk -lgdk -lglib-2.0 -lwx_gtk2u_xrc-2.8 -lgdk-x11-2.0 -lgtk-x11-2.0 -lgdk_pixbuf-2.0 -lgobject-2.0 -lm -lX11 -lpthread -lXinerama -lXrandr -lXcursor -lGL -lopenal -lasound I bet other programs I have will also need -lGLU and possibly others. When you're building on Linux you don't have to do anything special to get it to use OpenGL, I think it's also true for OSX. As far as OpenGL 3.x/4.x books or tutorials, I've found quite a few just googling, but lots of them were, shall we say, acquired by methods that are frowned upon. [EDIT] Thomas Fjellstrom said: Allegro supports OpenGL on all of its platforms. Even windows. You have to use [EDIT 2] Blasted the program over to a pristine installation of Slack14.1 on the other computer and lots of missing dependances for wx*, openal, etc. I'll see if I can fix it, then update the minimum linkage again. They all watch too much MSNBC... they get ideas. |
Kris Asick
Member #1,424
July 2001
|
To answer your first question, before creating your display object, call al_set_new_display_flags() and supply the appropriate OPENGL flags. You'll need to set ALLEGRO_OPENGL at the least though you may want to | in ALLEGRO_OPENGL_3_0 as well depending on what you want to do. As for the second question, Allegro is specifically designed to wrap around Direct3D/OpenGL so you don't have to learn to use them directly, however, you can indeed mix Allegro commands with OpenGL commands. Just keep in mind that if you make any modifications to the OpenGL state machine it may affect the way Allegro functions if you don't change the state back to the way it was before you do more Allegro stuff. --- Kris Asick (Gemini) |
Arthur Kalliokoski
Second in Command
February 2005
![]() |
My brain is really frying this late, but I did manage to find a post by Elias here which works. I used this CmakeCache.txt to build and install a shared monolithic library, copied /usr/lib/liballegro_monolith.so.5.1.7 to another computer which is totally innocent of Allegro, copied the allegro-5.1.7/build/examples/ex_video example to this other computer, downloaded http://upload.wikimedia.org/wikipedia/commons/b/bd/Elephants_Dream.ogg for a video file and used this script named "game" (remember to "chmod +x game") LD_LIBRARY_PATH=`pwd` ./ex_video Elephants_Dream.ogg It wouldn't run at first, complaining it couldn't find "/usr/lib/liballegro_monolith.so.5.1.7", so I made a soft link ln -s ./liballegro_monolith.so.5.1.7 liballegro_monolith.so.5.1 Then it complained it couldn't find libphysfs.so.1, so I did the same with that to get (soft link) libphysfs.so.1 and library libphysfs.so.2.0.3 in the same directory and it worked beautifully. I see a /usr/lib/libphysfs.a and I ought to be able to link that static library in somehow, but I'm too fried at the moment. [EDIT] I guess I could have removed the physfs link from the cmake command? This other computer is a single core 1.6Ghz Sempron with a Geforce 5600 FX (?) and it takes about 28% cpu to show the video. They all watch too much MSNBC... they get ideas. |
crexalbo
Member #15,035
April 2013
|
Okay, so i have to call al_set_new_display_flags like this: al_set_new_display_flags(ALLEGRO_WINDOWED | ALLEGRO_OPENGL | ALLEGRO_OPENGL_3_0); Just tried that out, and that seems to be what was causing my problems. I kept ALLEGRO_OPENGL_3_0 and omitted ALLEGRO_OPENGL. Also, another issue may have been my use of deprecated code because the tutorial i found was terrible. |
Thomas Fjellstrom
Member #476
June 2000
![]() |
ALLEGRO_OPENGL_3_0 is just a modifier to ALLEGRO_OPENGL. If you do not pass ALLEGRO_OPENGL you will get the D3D driver. Try omitting ALLEGRO_OPENGL_3_0, and upgrading your drivers. -- |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
The CMake build files have supported -DWANT_MONOLITH for a little while now. I've been building monoliths on Vista for a while now. Thomas Fjellstrom said: ALLEGRO_OPENGL_3_0 is just a modifier to ALLEGRO_OPENGL. If you do not pass ALLEGRO_OPENGL you will get the D3D driver. Try omitting ALLEGRO_OPENGL_3_0, and upgrading your drivers. Seeing as how many people screw that up and expect to be using OpenGL when they're still using D3D, why not just change the define for ALLEGRO_OPENGL_3_0 to OR in ALLEGRO_OPENGL? It doesn't really make sense to be able to set a flag that doesn't do anything in certain cases. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
|