![]() |
|
ALLEGRO_DIRECT3D not defined in this scope |
Arthur Kalliokoski
Second in Command
February 2005
![]() |
I tried using “Throughout history, poverty is the normal condition of man. Advances which permit this norm to be exceeded — here and there, now and then — are the work of an extremely small minority, frequently despised, often condemned, and almost always opposed by all right-thinking people. Whenever this tiny minority is kept from creating, or (as sometimes happens) is driven out of a society, the people then slip back into abject poverty. This is known as "bad luck.” ― Robert A. Heinlein |
Aaron Bolyard
Member #7,537
July 2006
![]() |
I'm pretty sure you need to add this include: #include <allegro5/allegro_direct3d.h>
|
Arthur Kalliokoski
Second in Command
February 2005
![]() |
I just tried that (in Linux) and it complains now about /usr/local/include/allegro5/allegro_direct3d.h:20:18: fatal error: d3d9.h: No such file or directory . I'm trying to differentiate between which graphic library is in effect without too many #ifdefs. “Throughout history, poverty is the normal condition of man. Advances which permit this norm to be exceeded — here and there, now and then — are the work of an extremely small minority, frequently despised, often condemned, and almost always opposed by all right-thinking people. Whenever this tiny minority is kept from creating, or (as sometimes happens) is driven out of a society, the people then slip back into abject poverty. This is known as "bad luck.” ― Robert A. Heinlein |
SiegeLord
Member #7,827
October 2006
![]() |
It used to be so that you had to include "allegro_direct3d.h" for the ALLEGRO_DIRECT3D and "allegro_opengl.h" for ALLEGRO_OPENGL. Then, for some reason, ALLEGRO_OPENGL was moved into the main allegro include, which left ALLEGRO_DIRECT3D inexplicably in its own header. EDIT: Incidentally, the reason why those were originally hidden away was to make it a tiny bit harder to write non-portable code. The thinking was that if you used the code in non-platform specific headers you'd automatically get portable code. Now with ALLEGRO_OPENGL being in the non-platform specific header, this is sort of moot... "For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18 |
Arthur Kalliokoski
Second in Command
February 2005
![]() |
OTOH, I looked at <allegro5/allegro_direct3d.h> on the Mingw includes and it says /* Display creation flag. */ #define ALLEGRO_DIRECT3D ALLEGRO_DIRECT3D_INTERNAL
which would seem to indicate that Linux should fail to create a display when ALLEGRO_DIRECT3D_INTERNAL was passed to al_set_new_display_flags(). Just a small error, though. “Throughout history, poverty is the normal condition of man. Advances which permit this norm to be exceeded — here and there, now and then — are the work of an extremely small minority, frequently despised, often condemned, and almost always opposed by all right-thinking people. Whenever this tiny minority is kept from creating, or (as sometimes happens) is driven out of a society, the people then slip back into abject poverty. This is known as "bad luck.” ― Robert A. Heinlein |
SiegeLord
Member #7,827
October 2006
![]() |
ALLEGRO_DIRECT3D_INTERNAL is internal though. It's not documented, and you're not supposed to use it. "For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18 |
Thomas Fjellstrom
Member #476
June 2000
![]() |
Not to mention that D3D is the default, and you shouldn't need to explicitly specify it. -- |
Arthur Kalliokoski
Second in Command
February 2005
![]() |
Well, now I have this (no idea what would happen on OSX or Android) active_gl = al_get_display_flags(display) & ALLEGRO_OPENGL; if(active_gl & ALLEGRO_OPENGL) { zz_draw_focus = &zz_draw_ogl_focus; } else //fall through to direct3d { zz_draw_focus = &zz_draw_d3d_focus; } I'll probably replace it with some private defines instead of putting the code directly in there. “Throughout history, poverty is the normal condition of man. Advances which permit this norm to be exceeded — here and there, now and then — are the work of an extremely small minority, frequently despised, often condemned, and almost always opposed by all right-thinking people. Whenever this tiny minority is kept from creating, or (as sometimes happens) is driven out of a society, the people then slip back into abject poverty. This is known as "bad luck.” ― Robert A. Heinlein |
Thomas Fjellstrom
Member #476
June 2000
![]() |
Everything but Windows is GL. That is a decent way of doing it. -- |
Elias
Member #358
May 2000
|
ALLEGRO_OPENGL always was public. And using Allegro to write a (platform-independent) OpenGL game is one of the use cases, it makes a lot of sense to do, including under Windows. -- |
SiegeLord
Member #7,827
October 2006
![]() |
Elias said: ALLEGRO_OPENGL always was public. No, it wasn't: git diff -r 17ccbaa{^,} -- include/allegro5/display_new.h diff --git a/include/allegro5/display_new.h b/include/allegro5/display_new.h index ee111c9..8302dc9 100644 --- a/include/allegro5/display_new.h +++ b/include/allegro5/display_new.h @@ -12,21 +12,20 @@ #endif /* Possible bit combinations for the flags parameter of al_create_display. */ - -#define ALLEGRO_WINDOWED 1 -#define ALLEGRO_FULLSCREEN 2 -// moved to allegro_opengl.h -//#define ALLEGRO_OPENGL 4 -// moved to allegro_direct3d.h -//#define ALLEGRO_DIRECT3D 8 -#define ALLEGRO_RESIZABLE 16 -//#define ALLEGRO_SINGLEBUFFER 32 -#define ALLEGRO_NOFRAME 64 -#define ALLEGRO_GENERATE_EXPOSE_EVENTS 128 -//is something using 256? didn't seem to work... -#define ALLEGRO_FULLSCREEN_WINDOW 512 +enum { + ALLEGRO_WINDOWED = 1 << 0, + ALLEGRO_FULLSCREEN = 1 << 1, + ALLEGRO_OPENGL = 1 << 2, + ALLEGRO_DIRECT3D_INTERNAL = 1 << 3, + ALLEGRO_RESIZABLE = 1 << 4, + ALLEGRO_NOFRAME = 1 << 5, + ALLEGRO_GENERATE_EXPOSE_EVENTS = 1 << 6, + ALLEGRO_OPENGL_3_0 = 1 << 7, + ALLEGRO_OPENGL_FORWARD_COMPATIBLE = 1 << 8, + ALLEGRO_FULLSCREEN_WINDOW = 1 << 9, /* This is set to mark a display used only internally. */ -#define ALLEGRO_INTERNAL 1024 + ALLEGRO_INTERNAL = 1 << 10 +}; /* Possible parameters for al_set_display_option. * Make sure to update ALLEGRO_EXTRA_DISPLAY_SETTINGS if you modify
git show 17ccbaa commit 17ccbaa2b3e7c4230971495c5e10e531c1bc4679 Author: Elias Pschernig <elias@users.sourceforge.net> Date: Sun Apr 4 20:58:11 2010 +0000 Fixed display flags which were in various #defines across several headers.
git diff -r 2f8d56{^,} -- include/allegro5/display_new.h diff --git a/include/allegro5/display_new.h b/include/allegro5/display_new.h index 55550cc..7617c6a 100644 --- a/include/allegro5/display_new.h +++ b/include/allegro5/display_new.h @@ -15,7 +15,8 @@ #define ALLEGRO_WINDOWED 1 #define ALLEGRO_FULLSCREEN 2 -#define ALLEGRO_OPENGL 4 +// moved to a5_opengl.h +//#define ALLEGRO_OPENGL 4 #define ALLEGRO_DIRECT3D 8 //#define ALLEGRO_GENERATE_UPDATE_EVENTS 64 #define ALLEGRO_RESIZABLE 16
git show 2f8d56 commit 2f8d565525fef076a31494dd71ef0b4b0884709c Author: Milan Mimica <mmimica@users.sourceforge.net> Date: Sun Oct 12 11:23:08 2008 +0000 To prevent namespce pollution, and accidental usage of OpenGL-specific functions, programs using OpenGL must include allegro5/a5_opengl.h from now on.
Quote: And using Allegro to write a (platform-independent) OpenGL game is one of the use cases, it makes a lot of sense to do, including under Windows. Pretty sure Allegro can be compiled without OpenGL support on Windows. "For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18 |
Sebastian Steinhauer
Member #12,449
December 2010
![]() |
Having ALLEGRO_OPENGL in the "default" headers while ALLEGRO_DIRECT3D needs to have allegro_direct3d.h included is a bit irritating. To have no problems with that I wrote some lines to work around this problem. 1#ifdef ALLEGRO_WINDOWS
2#include <allegro5/allegro_direct3d.h>
3#else
4#define ALLEGRO_DIRECT3D 0 /* dummy define for non Win systems */
5#endif /* ALLEGRO_WINDOWS */
This helps me having D3D on Unix systems, too. (In my project the user can choose the renderer if he wants to).8-) |
Peter Wang
Member #23
April 2000
|
Please don't do that. At worst, alias ALLEGRO_DIRECT3D to ALLEGRO_DIRECT3D_INTERNAL.
|
Thomas Fjellstrom
Member #476
June 2000
![]() |
Or don't include the D3D stuff on systems that don't have D3D... Doesn't really make sense to provide the user an option to select between D3D and OpenGL on linux for example. -- |
|