5 #ifndef _allegrogl_included_alleggl_h 6 #define _allegrogl_included_alleggl_h 10 #ifdef ALLEGRO_WINDOWS 12 #ifndef WIN32_LEAN_AND_MEAN 13 #define WIN32_LEAN_AND_MEAN 14 #define WIN32_LEAN_AND_MEAN_defined 18 typedef int32_t INT32;
19 typedef __int64 INT64;
24 #ifdef WIN32_LEAN_AND_MEAN_defined 25 #undef WIN32_LEAN_AND_MEAN_defined 26 #undef WIN32_LEAN_AND_MEAN 32 #if (defined ALLEGRO_GL_DYNAMIC) && (defined ALLEGRO_WINDOWS) 33 #ifdef ALLEGRO_GL_SRC_BUILD 34 #define _AGL_DLL __declspec(dllexport) 36 #define _AGL_DLL __declspec(dllimport) 42 #define AGL_VAR(type, name) extern _AGL_DLL type name 44 #if (defined ALLEGRO_GL_DYNAMIC) && (defined ALLEGRO_WINDOWS) 45 #define AGL_FUNC(type, name, args) extern _AGL_DLL type __cdecl name args 47 #define AGL_FUNC(type, name, args) extern type name args 53 #include <OpenGL/OpenGL.h> 54 #include <OpenGL/gl.h> 55 #include <OpenGL/glext.h> 57 #ifndef GL_GLEXT_PROTOTYPES 58 #define GL_GLEXT_PROTOTYPES 67 #define __glx_glxext_h_ 72 #undef __glx_glxext_h_ 77 #include "allegrogl/gl_ext.h" 79 #ifdef ALLEGRO_WITH_XWINDOWS 80 #if (ALLEGRO_SUB_VERSION == 2) && (ALLEGRO_WIP_VERSION < 2) 81 # ifndef HAVE_LIBPTHREAD 82 # error AllegroGL requires Allegro to have pthread support enabled! 85 # ifndef ALLEGRO_HAVE_LIBPTHREAD 86 # error AllegroGL requires Allegro to have pthread support enabled! 89 #include "allegrogl/alleggl_config.h" 98 #define AGL_SUB_VERSION 4 99 #define AGL_WIP_VERSION 4 100 #define AGL_VERSION_STR "0.4.4" 105 #if (ALLEGRO_VERSION < 4 || (ALLEGRO_VERSION == 4 && ALLEGRO_SUB_VERSION < 2)) 106 #error AllegroGL requires Allegro 4.2.0 or later to compile! 108 #ifndef GL_VERSION_1_1 109 #error AllegroGL requires OpenGL 1.1 libraries or later to compile! 117 #ifdef ALLEGRO_WINDOWS 120 #ifndef PFD_SWAP_LAYER_BUFFERS 121 #define PFD_SWAP_LAYER_BUFFERS 0x00000800 124 #ifndef PFD_GENERIC_ACCELERATED 125 #define PFD_GENERIC_ACCELERATED 0x00001000 128 #ifndef PFD_SUPPORT_DIRECTDRAW 129 #define PFD_SUPPORT_DIRECTDRAW 0x00002000 132 #ifndef CDS_FULLSCREEN 133 #define CDS_FULLSCREEN 0x00000004 136 #ifndef ENUM_CURRENT_SETTINGS 137 #define ENUM_CURRENT_SETTINGS ((DWORD)-1) 143 #define AGL_ERROR_SIZE 256 144 AGL_VAR(
char, allegro_gl_error[AGL_ERROR_SIZE]);
170 #define allegro_gl_begin() ; 180 #define allegro_gl_end() ; 193 #define AGL_ALLEGRO_FORMAT 0x00000001 199 #define AGL_RED_DEPTH 0x00000002 205 #define AGL_GREEN_DEPTH 0x00000004 211 #define AGL_BLUE_DEPTH 0x00000008 218 #define AGL_ALPHA_DEPTH 0x00000010 223 #define AGL_COLOR_DEPTH 0x00000020 231 #define AGL_ACC_RED_DEPTH 0x00000040 238 #define AGL_ACC_GREEN_DEPTH 0x00000080 246 #define AGL_ACC_BLUE_DEPTH 0x00000100 254 #define AGL_ACC_ALPHA_DEPTH 0x00000200 260 #define AGL_DOUBLEBUFFER 0x00000400 269 #define AGL_STEREO 0x00000800 275 #define AGL_AUX_BUFFERS 0x00001000 282 #define AGL_Z_DEPTH 0x00002000 291 #define AGL_STENCIL_DEPTH 0x00004000 296 #define AGL_WINDOW_X 0x00008000 300 #define AGL_WINDOW_Y 0x00010000 310 #define AGL_RENDERMETHOD 0x00020000 315 #define AGL_FULLSCREEN 0x00040000 320 #define AGL_WINDOWED 0x00080000 337 #define AGL_VIDEO_MEMORY_POLICY 0x00100000 361 #define AGL_SAMPLE_BUFFERS 0x00200000 369 #define AGL_SAMPLES 0x00400000 375 #define AGL_FLOAT_COLOR 0x00800000 379 #define AGL_FLOAT_Z 0x01000000 386 #define AGL_CONFIG_RESRVED 0xA000000 391 #define AGL_DONTCARE 0 392 #define AGL_SUGGEST -1 393 #define AGL_REQUIRE -2 400 #define AGL_RELEASE 2 406 AGL_FUNC(void, allegro_gl_clear_settings, (void)); 433 # define GFX_OPENGL_WINDOWED 435 # define GFX_OPENGL_FULLSCREEN 443 #if defined ALLEGROGL_GENERIC_DRIVER 446 #define GFX_OPENGL_WINDOWED AL_ID('O','G','L','W') 447 #define GFX_OPENGL_FULLSCREEN AL_ID('O','G','L','F') 452 #define GFX_OPENGL_WINDOWED AL_ID('O','G','L','W') 453 #define GFX_OPENGL_FULLSCREEN AL_ID('O','G','L','F') 455 #elif defined ALLEGRO_WITH_XWINDOWS 457 #define GFX_OPENGL_WINDOWED AL_ID('O','G','L','W') 458 #define GFX_OPENGL_FULLSCREEN AL_ID('O','G','L','F') 460 #elif defined ALLEGRO_MACOSX 462 #define GFX_OPENGL_WINDOWED AL_ID('O','G','L','W') 463 #define GFX_OPENGL_FULLSCREEN AL_ID('O','G','L','F') 466 #warning Unknown or unsupported platform. 470 #define GFX_OPENGL AL_ID('O','G','L','D') 476 extern GFX_DRIVER gfx_allegro_gl_default;
477 #ifdef GFX_OPENGL_WINDOWED 478 extern GFX_DRIVER gfx_allegro_gl_windowed;
480 #ifdef GFX_OPENGL_FULLSCREEN 481 extern GFX_DRIVER gfx_allegro_gl_fullscreen;
509 GLint internal_format));
517 GLint internal_format));
522 #define AGL_TEXTURE_MIPMAP 0x01 527 #define AGL_TEXTURE_HAS_ALPHA 0x02 533 #define AGL_TEXTURE_FLIP 0x04 538 #define AGL_TEXTURE_MASKED 0x08 544 #define AGL_TEXTURE_RESCALE 0x10 549 #define AGL_TEXTURE_ALPHA_ONLY 0x20 594 float *x,
float *y,
float *z));
596 double *x,
double *y,
double *z));
622 #define AGL_FONT_TYPE_DONT_CARE -1 633 #define AGL_FONT_TYPE_BITMAP 0 645 #define AGL_FONT_TYPE_OUTLINE 1 657 #define AGL_FONT_TYPE_TEXTURED 2 665 #define AGL_FONT_STYLE_BOLD 1 670 #define AGL_FONT_STYLE_BLACK 2 675 #define AGL_FONT_STYLE_ITALIC 4 680 #define AGL_FONT_STYLE_UNDERLINE 8 685 #define AGL_FONT_STYLE_STRIKEOUT 16 692 #define AGL_FONT_STYLE_ANTI_ALIASED 32 700 #define AGL_FONT_POLYGONS 1 709 #define AGL_FONT_LINES 2 713 int color, AL_CONST
char *format, ...));
715 AL_CONST
char *format, ...));
723 int w,
int h,
float depth,
int start,
int end));
755 #define AGL_DEFINE_PROC_TYPE 762 #if defined ALLEGRO_WINDOWS 763 #define AGL_DEFINE_PROC_TYPE(type, name, args) \ 764 typedef type (APIENTRY * name) args; 766 #define AGL_DEFINE_PROC_TYPE(type, name, args) \ 767 typedef type (*name) args; 797 AGL_FUNC(
int,
algl_alert, (AL_CONST
char *s1, AL_CONST
char *s2, AL_CONST
char *s3,
798 AL_CONST
char *b1, AL_CONST
char *b2,
int c1,
int c2));
799 AGL_FUNC(
int,
algl_alert3, (AL_CONST
char *s1, AL_CONST
char *s2, AL_CONST
char *s3,
800 AL_CONST
char *b1, AL_CONST
char *b2, AL_CONST
char *b3,
801 int c1,
int c2,
int c3));
814 #ifdef GL_VERSION_1_1 815 #ifndef GL_TEXTURE_BINDING_2D 817 #ifdef GL_TEXTURE_2D_BINDING 818 #define GL_TEXTURE_BINDING_2D GL_TEXTURE_2D_BINDING 823 #ifdef GL_TEXTURE_BINDING_2D 824 #define GL_TEXTURE_2D_BINDING GL_TEXTURE_BINDING_2D 829 #ifndef GL_TEXTURE_BINDING_2D 830 #warning "GL_TEXTURE_BINDING_2D or GL_TEXTURE_2D_BINDING isn't defined by your" 831 #warning "OpenGL headers. Make sure you have a genuine set of headers for" 832 #warning "OpenGL 1.1 (or greater)" void allegro_gl_unset_projection(void)
Restores previously saved projection.
int allegro_gl_printf_ex(AL_CONST FONT *f, float x, float y, float z, AL_CONST char *format,...)
Prints a formatted string (printf style) on the screen.
float allegro_gl_opengl_version(void)
Returns the OpenGL version number of the client (the computer the program is running on)...
void allegro_gl_set_font_generation_mode(int mode)
Set the font generation mode for system fonts.
FONT * allegro_gl_load_system_font_ex(char *name, int type, int style, int w, int h, float depth, int start, int end)
Loads a system font.
void allegro_gl_destroy_font(FONT *f)
void allegro_gl_destroy_font(FONT *usefont)
void allegro_gl_GLdouble_to_MATRIX_f(GLdouble gl[16], MATRIX_f *m)
Converts an Allegro fixed-point matrix to an array of floats suitable for OpenGL's matrix operations...
void allegro_gl_apply_quat(QUAT *q)
Converts a quaternion to a vector/angle, which can be used with glRotate*().
int install_allegro_gl(void)
Installs the AllegroGL addon to Allegro.
GLuint allegro_gl_make_texture_ex(int flags, BITMAP *bmp, GLint internal_format)
Uploads an Allegro BITMAP to the GL driver as a texture.
int d_algl_viewport_proc(int msg, DIALOG *d, int c)
Creates a viewport object where OpenGL commands can be performed.
int allegro_gl_get(int option)
Reads the setting of a configuration option.
void allegro_gl_unset_allegro_mode(void)
Restores previous OpenGL settings.
FONT * allegro_gl_convert_allegro_font_ex(FONT *f, int type, float scale, GLint format)
Converts a regular Allegro FONT to the AGL format for 3D display.
size_t allegro_gl_list_font_textures(FONT *f, GLuint *ids, size_t max_num_id)
List the texture ID of all textures forming the specified font.
FONT * allegro_gl_load_system_font(char *name, int style, int w, int h)
Short hand for aglf_load_system_font_ex(name, AGL_FONT_TYPE_OUTLINE, style, w, h, 0...
void algl_draw_mouse(void)
Draws a mouse pointer on the screen.
void * allegro_gl_get_proc_address(AL_CONST char *name)
Helper to get the address of an OpenGL symbol.
FONT * allegro_gl_convert_allegro_font(FONT *f, int type, float scale)
Equivalent to:
GLint allegro_gl_get_texture_format(BITMAP *bmp)
Returns the OpenGL internal texture format for this bitmap.
void algl_set_mouse_drawer(void(*user_draw_mouse)(void))
Sets (or clears) a user mouse drawing callback.
void allegro_gl_quat_to_glrotatef(QUAT *q, float *angle, float *x, float *y, float *z)
Converts a quaternion to a vector/angle, which can be used with glRotate*().
int allegro_gl_use_alpha_channel(int enable)
Tell AllegroGL to use Alpha channel or not when generating textures via its functions.
void allegro_gl_MATRIX_f_to_GLdouble(MATRIX_f *m, GLdouble gl[16])
Converts an Allegro floating-point matrix to an array of doubles suitable for OpenGL's matrix operati...
void remove_allegro_gl(void)
Removes the AllegroGL addon.
void allegro_gl_flip(void)
Flips the front and back framebuffers.
int allegro_gl_use_mipmapping(int enable)
Tell AllegroGL to use Mipmapping or not when generating textures via its functions.
void allegro_gl_GLfloat_to_MATRIX(GLfloat gl[16], MATRIX *m)
Converts an Allegro fixed-point matrix to an array of floats suitable for OpenGL's matrix operations...
void allegro_gl_save_settings(void)
Saves the current settings (as specified by allegro_gl_set()) to the current config file...
void allegro_gl_set_projection(void)
Prepares for Allegro drawing to the screen.
void allegro_gl_set(int option, int value)
Sets a configuration option.
GLint allegro_gl_set_texture_format(GLint format)
Sets the color format you'd like OpenGL to use for its textures.
int allegro_gl_check_texture(BITMAP *bmp)
Checks whether the specified bitmap is of the proper size for texturing.
int allegro_gl_flip_texture(int enable)
Tell AllegroGL to flip the texture vertically or not when generating textures via its functions...
int algl_alert(AL_CONST char *s1, AL_CONST char *s2, AL_CONST char *s3, AL_CONST char *b1, AL_CONST char *b2, int c1, int c2)
AllegroGL-friendly version of Allegro's alert.
void allegro_gl_MATRIX_to_GLdouble(MATRIX *m, GLdouble gl[16])
Converts an Allegro fixed-point matrix to an array of doubles suitable for OpenGL's matrix operations...
int algl_popup_dialog(DIALOG *dialog, int focus_obj)
AllegroGL-friendly version of popup_dialog.
GLenum allegro_gl_get_bitmap_color_format(BITMAP *bmp)
AllegroGL will generate mipmaps for this texture.
int allegro_gl_is_extension_supported(AL_CONST char *extension)
This function is an helper to determine whether an OpenGL extension is available or not...
GLuint allegro_gl_make_masked_texture(BITMAP *bmp)
Uploads an Allegro BITMAP to the GL driver as a texture.
int allegro_gl_check_texture_ex(int flags, BITMAP *bmp, GLint internal_format)
Checks whether the specified bitmap is of the proper size for texturing.
void allegro_gl_GLfloat_to_MATRIX_f(GLfloat gl[16], MATRIX_f *m)
Converts an Allegro fixed-point matrix to an array of floats suitable for OpenGL's matrix operations...
void allegro_gl_set_allegro_mode(void)
Prepares for Allegro drawing to the screen.
GLuint allegro_gl_make_texture(BITMAP *bmp)
Uploads an Allegro BITMAP to the GL driver as a texture.
void allegro_gl_quat_to_glrotated(QUAT *q, double *angle, double *x, double *y, double *z)
Converts a quaternion to a vector/angle, which can be used with glRotate*().
int algl_do_dialog(DIALOG *dialog, int focus_obj)
AllegroGL-friendly version of do_dialog.
void allegro_gl_MATRIX_f_to_GLfloat(MATRIX_f *m, GLfloat gl[16])
Converts an Allegro floating-point matrix to an array of floats suitable for OpenGL's matrix operatio...
int algl_alert3(AL_CONST char *s1, AL_CONST char *s2, AL_CONST char *s3, AL_CONST char *b1, AL_CONST char *b2, AL_CONST char *b3, int c1, int c2, int c3)
AllegroGL-friendly version of Allegro's alert3.
void allegro_gl_MATRIX_to_GLfloat(MATRIX *m, GLfloat gl[16])
Converts an Allegro fixed-point matrix to an array of floats suitable for OpenGL's matrix operations...
GLint allegro_gl_set_video_bitmap_color_depth(int bpp)
Sets the color depth you'd like AllegroGL to use for video bitmaps.
void allegro_gl_load_settings(void)
Loads the settings from the current config file, in the section [OpenGL].
int allegro_gl_printf(AL_CONST FONT *f, float x, float y, float z, int color, AL_CONST char *format,...)
Equivalent to:
GLenum allegro_gl_get_bitmap_type(BITMAP *bmp)
AllegroGL will generate mipmaps for this texture.
void allegro_gl_GLdouble_to_MATRIX(GLdouble gl[16], MATRIX *m)
Converts an Allegro fixed-point matrix to an array of floats suitable for OpenGL's matrix operations...