I'd like to make a game, using OpenGL and Allegro.
so, how to use OpenGL with Allegro5?
I read a lot of topics, wiki articles and so on (on allegro.wiki good topic is only about allegro4). I searched in google and this forum. And found nothing what can completely describe it.
Does somebody know how to use A5 and Ogl together?
my code:
OpenGL is just a state machine, so mixing and matching Allegro and OpenGL is easy enough. If you can code in both, then all you need to do is load in Allegro and make OpenGL calls whenever you need to do something Allegro can't do itself. Also, there's a set of OpenGL specific Allegro functions designed to make it easier to use the two together, which you can find information about in the Allegro manual.
However, remember that you need to set ALLEGRO_WINDOWED or ALLEGRO_FULLSCREEN along with the ALLEGRO_OPENGL flag like this:
al_set_new_display_flags(ALLEGRO_FULLSCREEN|ALLEGRO_OPENGL);
ALLEGRO_FULLSCREEN_WINDOW is probably a better option than ALLEGRO_FULLSCREEN.
ALLEGRO_FULLSCREEN_WINDOW is probably a better option than ALLEGRO_FULLSCREEN.
Is there any reason why?
Is there any reason why?
Non-native resolutions usually look like crap.
I just use this little routine I whipped up to get the user's desktop res:
void GetDesktopResolution (int &ret_width, int &ret_height) { RECT rc; GetWindowRect(GetDesktopWindow(),&rc); ret_width = rc.right - rc.left; ret_height = rc.bottom - rc.top; }
If it fails to set resolution, which is only going to happen on multi-monitor systems, I scale back to safe values in an attempt to get the game to start, then let the user try to set their own resolution settings in the game options.
Granted, this code only works in Windows, so if you're going cross-platform you'll need other solutions too.