alleggl.h

Go to the documentation of this file.
00001 
00005 #ifndef _allegrogl_included_alleggl_h
00006 #define _allegrogl_included_alleggl_h
00007 
00008 #include <allegro.h>
00009 
00010 #ifdef ALLEGRO_WINDOWS
00011 
00012 #ifndef WIN32_LEAN_AND_MEAN
00013 #define WIN32_LEAN_AND_MEAN
00014 #define WIN32_LEAN_AND_MEAN_defined
00015 #endif /* WIN32_LEAN_AND_MEAN */
00016 
00017 #ifdef ALLEGRO_DMC
00018 typedef int32_t INT32;
00019 typedef __int64 INT64;
00020 #endif
00021 
00022 #include <winalleg.h>
00023 
00024 #ifdef WIN32_LEAN_AND_MEAN_defined
00025 #undef WIN32_LEAN_AND_MEAN_defined
00026 #undef WIN32_LEAN_AND_MEAN
00027 #endif /* WIN32_LEAN_AND_MEAN_defined */
00028 
00029 #endif /* ALLEGRO_WINDOWS */
00030 
00031 
00032 #if (defined ALLEGRO_GL_DYNAMIC) && (defined ALLEGRO_WINDOWS)
00033     #ifdef ALLEGRO_GL_SRC_BUILD
00034         #define _AGL_DLL __declspec(dllexport)
00035     #else
00036         #define _AGL_DLL __declspec(dllimport)
00037     #endif /* ALLEGRO_GL_SRC_BUILD */
00038 #else
00039     #define _AGL_DLL
00040 #endif /* (defined ALLEGRO_GL_DYNAMIC) && (defined ALLEGRO_WINDOWS) */
00041 
00042 #define AGL_VAR(type, name) extern _AGL_DLL type name
00043 
00044 #if (defined ALLEGRO_GL_DYNAMIC) && (defined ALLEGRO_WINDOWS)
00045     #define AGL_FUNC(type, name, args) extern _AGL_DLL type __cdecl name args
00046 #else
00047     #define AGL_FUNC(type, name, args) extern type name args
00048 #endif /* (defined ALLEGRO_GL_DYNAMIC) && (defined ALLEGRO_WINDOWS) */
00049 
00050 
00051 #ifdef ALLEGRO_MACOSX
00052 
00053 #include <OpenGL/OpenGL.h>
00054 #include <OpenGL/gl.h>
00055 #include <OpenGL/glext.h>
00056 
00057 #ifndef GL_GLEXT_PROTOTYPES
00058 #define GL_GLEXT_PROTOTYPES
00059 #endif
00060 
00061 #else /* ALLEGRO_MACOSX */
00062 
00063 /* HACK: Prevent both Mesa and SGI's broken headers from screwing us */
00064 #define __glext_h_
00065 #define __glxext_h_
00066 #include <GL/gl.h>
00067 #undef  __glext_h_
00068 #undef  __glxext_h_
00069 
00070 #endif /* ALLEGRO_MACOSX */
00071 
00072 
00073 #include "allegrogl/gl_ext.h"
00074 
00075 #ifdef ALLEGRO_WITH_XWINDOWS
00076 #if (ALLEGRO_SUB_VERSION == 2) && (ALLEGRO_WIP_VERSION < 2)
00077 #   ifndef HAVE_LIBPTHREAD
00078 #      error AllegroGL requires Allegro to have pthread support enabled!
00079 #   endif
00080 #else
00081 #   ifndef ALLEGRO_HAVE_LIBPTHREAD
00082 #      error AllegroGL requires Allegro to have pthread support enabled!
00083 #   endif
00084 #endif
00085 #include <alleggl_config.h>
00086 #endif
00087 
00088 
00093 #define AGL_VERSION     0            
00094 #define AGL_SUB_VERSION 4            
00095 #define AGL_WIP_VERSION 3            
00096 #define AGL_VERSION_STR "0.4.3"      
00097 
00100 /* Version Check */
00101 #if (ALLEGRO_VERSION < 4 || (ALLEGRO_VERSION == 4 && ALLEGRO_SUB_VERSION < 2))
00102     #error AllegroGL requires Allegro 4.2.0 or later to compile!
00103 #endif
00104 #ifndef GL_VERSION_1_1
00105     #error AllegroGL requires OpenGL 1.1 libraries or later to compile!
00106 #endif
00107 
00108 
00109 #ifdef __cplusplus
00110 extern "C" {
00111 #endif
00112 
00113 #ifdef ALLEGRO_WINDOWS
00114     
00115 /* Missing #defines from Mingw */
00116 #ifndef PFD_SWAP_LAYER_BUFFERS
00117 #define PFD_SWAP_LAYER_BUFFERS  0x00000800
00118 #endif
00119 
00120 #ifndef PFD_GENERIC_ACCELERATED
00121 #define PFD_GENERIC_ACCELERATED 0x00001000
00122 #endif
00123 
00124 #ifndef PFD_SUPPORT_DIRECTDRAW
00125 #define PFD_SUPPORT_DIRECTDRAW  0x00002000
00126 #endif
00127 
00128 #ifndef CDS_FULLSCREEN
00129 #define CDS_FULLSCREEN      0x00000004
00130 #endif
00131 
00132 #ifndef ENUM_CURRENT_SETTINGS
00133 #define ENUM_CURRENT_SETTINGS       ((DWORD)-1)
00134 #endif
00135 
00136 #endif
00137 
00138 
00139 #define AGL_ERROR_SIZE 256
00140 AGL_VAR(char, allegro_gl_error[AGL_ERROR_SIZE]);
00141 
00142 
00152 AGL_FUNC(int, install_allegro_gl, (void));
00153 AGL_FUNC(void, remove_allegro_gl, (void));
00154 
00155 AGL_FUNC(void, allegro_gl_flip, (void));
00156 AGL_FUNC(float, allegro_gl_opengl_version, (void));
00157 
00166 #define allegro_gl_begin() ;
00167 
00176 #define allegro_gl_end() ;
00177 
00189 #define AGL_ALLEGRO_FORMAT  0x00000001
00190 
00195 #define AGL_RED_DEPTH       0x00000002
00196 
00201 #define AGL_GREEN_DEPTH     0x00000004
00202 
00207 #define AGL_BLUE_DEPTH      0x00000008
00208 
00214 #define AGL_ALPHA_DEPTH     0x00000010
00215 
00219 #define AGL_COLOR_DEPTH     0x00000020
00220 
00221 
00227 #define AGL_ACC_RED_DEPTH   0x00000040
00228 
00234 #define AGL_ACC_GREEN_DEPTH 0x00000080
00235 
00236 
00242 #define AGL_ACC_BLUE_DEPTH  0x00000100
00243 
00244 
00250 #define AGL_ACC_ALPHA_DEPTH 0x00000200
00251 
00256 #define AGL_DOUBLEBUFFER    0x00000400
00257 
00265 #define AGL_STEREO          0x00000800
00266 
00267 
00271 #define AGL_AUX_BUFFERS     0x00001000
00272 
00273 
00278 #define AGL_Z_DEPTH         0x00002000
00279 
00280 
00287 #define AGL_STENCIL_DEPTH   0x00004000
00288 
00292 #define AGL_WINDOW_X        0x00008000
00293 
00296 #define AGL_WINDOW_Y        0x00010000
00297 
00306 #define AGL_RENDERMETHOD    0x00020000
00307 
00311 #define AGL_FULLSCREEN      0x00040000
00312 
00316 #define AGL_WINDOWED        0x00080000
00317 
00333 #define AGL_VIDEO_MEMORY_POLICY     0x00100000
00334 
00357 #define AGL_SAMPLE_BUFFERS  0x00200000
00358 
00365 #define AGL_SAMPLES        0x00400000
00366 
00371 #define AGL_FLOAT_COLOR    0x00800000
00372 
00375 #define AGL_FLOAT_Z        0x01000000
00376 
00377 
00378 
00379 /* XXX <rohannessian> I'm reserving 2 bits here for later expansion. DO NOT USE
00380  * without consulting me first.
00381  */
00382 #define AGL_CONFIG_RESRVED 0xA000000
00383 
00384 
00387 #define AGL_DONTCARE   0 
00388 #define AGL_SUGGEST   -1 
00389 #define AGL_REQUIRE   -2 
00390 
00395 #define AGL_KEEP    1 
00396 #define AGL_RELEASE 2 
00397 
00402 AGL_FUNC(void, allegro_gl_clear_settings, (void));
00403 AGL_FUNC(void, allegro_gl_set, (int option, int value));
00404 AGL_FUNC(int,  allegro_gl_get, (int option));
00405 AGL_FUNC(void, allegro_gl_save_settings, (void));
00406 AGL_FUNC(void, allegro_gl_load_settings, (void));
00423 #if defined DOXYGEN  /* Is this a documentation scan? */
00424 
00429 # define GFX_OPENGL_WINDOWED
00430 
00431 # define GFX_OPENGL_FULLSCREEN
00432 
00433   #define GFX_OPENGL
00434 
00437 #else
00438 
00439 #if defined ALLEGROGL_GENERIC_DRIVER
00440   /* Allegro is able to determine at run-time if windowed or fullscreen modes
00441      are available */
00442   #define GFX_OPENGL_WINDOWED               AL_ID('O','G','L','W')
00443   #define GFX_OPENGL_FULLSCREEN             AL_ID('O','G','L','F')
00444 
00445 #else
00446 #if defined _WIN32
00447   /* Windows always supports fullscreen */
00448   #define GFX_OPENGL_WINDOWED               AL_ID('O','G','L','W')
00449   #define GFX_OPENGL_FULLSCREEN             AL_ID('O','G','L','F')
00450 
00451 #elif defined ALLEGROGL_HAVE_XF86VIDMODE
00452   /* X fullscreen support only works with the XF86 VidMode extension */
00453   #define GFX_OPENGL_WINDOWED               AL_ID('O','G','L','W')
00454   #define GFX_OPENGL_FULLSCREEN             AL_ID('O','G','L','F')
00455 
00456 #elif defined ALLEGRO_WITH_XWINDOWS
00457   /* Plain X only supports windowed modes */
00458   #define GFX_OPENGL_WINDOWED               AL_ID('O','G','L','W')
00459   
00460 #elif defined ALLEGRO_MACOSX
00461   /* MacOS X always supports fullscreen */
00462   #define GFX_OPENGL_WINDOWED               AL_ID('O','G','L','W')
00463   #define GFX_OPENGL_FULLSCREEN             AL_ID('O','G','L','F')
00464 
00465 #else
00466   #warning Unknown or unsupported platform.
00467 #endif
00468 #endif
00469 
00470 #define GFX_OPENGL                  AL_ID('O','G','L','D')
00471 
00472 #endif
00473 
00474 
00475 /* Declare graphics driver objects */
00476 extern GFX_DRIVER gfx_allegro_gl_default;
00477 #ifdef GFX_OPENGL_WINDOWED
00478 extern GFX_DRIVER gfx_allegro_gl_windowed;
00479 #endif
00480 #ifdef GFX_OPENGL_FULLSCREEN
00481 extern GFX_DRIVER gfx_allegro_gl_fullscreen;
00482 #endif
00483 
00484 
00492 AGL_FUNC(GLint, allegro_gl_set_video_bitmap_color_depth, (int bpp));
00504 AGL_FUNC(int, allegro_gl_use_mipmapping, (int enable));
00505 AGL_FUNC(int, allegro_gl_use_alpha_channel, (int enable));
00506 AGL_FUNC(int, allegro_gl_flip_texture, (int enable));
00507 AGL_FUNC(int, allegro_gl_check_texture, (BITMAP *bmp));
00508 AGL_FUNC(int, allegro_gl_check_texture_ex, (int flags, BITMAP *bmp,
00509                                        GLint internal_format));
00510 AGL_FUNC(GLint, allegro_gl_get_texture_format, (BITMAP *bmp));
00511 AGL_FUNC(GLint, allegro_gl_set_texture_format, (GLint format));
00512 AGL_FUNC(GLenum, allegro_gl_get_bitmap_type, (BITMAP *bmp));
00513 AGL_FUNC(GLenum, allegro_gl_get_bitmap_color_format, (BITMAP *bmp));
00514 AGL_FUNC(GLuint, allegro_gl_make_texture, (BITMAP *bmp));
00515 AGL_FUNC(GLuint, allegro_gl_make_masked_texture, (BITMAP *bmp));
00516 AGL_FUNC(GLuint, allegro_gl_make_texture_ex,(int flags, BITMAP *bmp,
00517                                          GLint internal_format));
00518 
00519 
00522 #define AGL_TEXTURE_MIPMAP      0x01
00523 
00527 #define AGL_TEXTURE_HAS_ALPHA   0x02
00528 
00533 #define AGL_TEXTURE_FLIP        0x04
00534 
00538 #define AGL_TEXTURE_MASKED      0x08
00539 
00544 #define AGL_TEXTURE_RESCALE     0x10
00545 
00546 
00549 #define AGL_TEXTURE_ALPHA_ONLY  0x20
00550 
00561 AGL_FUNC(void, allegro_gl_set_allegro_mode, (void));
00562 AGL_FUNC(void, allegro_gl_unset_allegro_mode, (void));
00563 AGL_FUNC(void, allegro_gl_set_projection, (void));
00564 AGL_FUNC(void, allegro_gl_unset_projection, (void));
00578 AGL_FUNC(void, allegro_gl_MATRIX_to_GLfloat, (MATRIX *m, GLfloat gl[16]));
00579 AGL_FUNC(void, allegro_gl_MATRIX_to_GLdouble, (MATRIX *m, GLdouble gl[16]));
00580 AGL_FUNC(void, allegro_gl_MATRIX_f_to_GLfloat, (MATRIX_f *m, GLfloat gl[16]));
00581 AGL_FUNC(void, allegro_gl_MATRIX_f_to_GLdouble, (MATRIX_f *m, GLdouble gl[16]));
00582 
00583 AGL_FUNC(void, allegro_gl_GLfloat_to_MATRIX, (GLfloat gl[16], MATRIX *m));
00584 AGL_FUNC(void, allegro_gl_GLdouble_to_MATRIX, (GLdouble gl[16], MATRIX *m));
00585 AGL_FUNC(void, allegro_gl_GLfloat_to_MATRIX_f, (GLfloat gl[16], MATRIX_f *m));
00586 AGL_FUNC(void, allegro_gl_GLdouble_to_MATRIX_f, (GLdouble gl[16], MATRIX_f *m));
00587 
00592 AGL_FUNC(void, allegro_gl_apply_quat, (QUAT *q));
00593 AGL_FUNC(void, allegro_gl_quat_to_glrotatef, (QUAT *q, float *angle,
00594                                          float *x, float *y, float *z));
00595 AGL_FUNC(void, allegro_gl_quat_to_glrotated, (QUAT *q, double *angle,
00596                                          double *x, double *y, double *z));
00618 /* These define the supported font types */
00622 #define AGL_FONT_TYPE_DONT_CARE     -1
00623 
00633 #define AGL_FONT_TYPE_BITMAP         0
00634 
00645 #define AGL_FONT_TYPE_OUTLINE        1
00646 
00657 #define AGL_FONT_TYPE_TEXTURED       2
00658 
00659 
00660 /* These defines the font styles for system generated fonts */
00665 #define AGL_FONT_STYLE_BOLD          1
00666 
00670 #define AGL_FONT_STYLE_BLACK         2
00671 
00675 #define AGL_FONT_STYLE_ITALIC        4
00676 
00680 #define AGL_FONT_STYLE_UNDERLINE     8
00681 
00685 #define AGL_FONT_STYLE_STRIKEOUT    16
00686 
00692 #define AGL_FONT_STYLE_ANTI_ALIASED 32
00693 
00700 #define AGL_FONT_POLYGONS 1
00701 
00702 
00709 #define AGL_FONT_LINES    2
00710 
00711 
00712 AGL_FUNC(int, allegro_gl_printf, (AL_CONST FONT *f, float x, float y, float z,
00713                              int color, AL_CONST char *format, ...));
00714 AGL_FUNC(int, allegro_gl_printf_ex, (AL_CONST FONT *f, float x, float y, float z,
00715                              AL_CONST char *format, ...));
00716 AGL_FUNC(FONT*, allegro_gl_convert_allegro_font, (FONT *f, int type, float scale));
00717 AGL_FUNC(FONT*, allegro_gl_convert_allegro_font_ex, (FONT *f, int type, float scale,
00718                                                 GLint format));
00719 
00720 AGL_FUNC(void, allegro_gl_set_font_generation_mode, (int mode));
00721 AGL_FUNC(FONT*, allegro_gl_load_system_font, (char *name, int style, int w, int h));
00722 AGL_FUNC(FONT*, allegro_gl_load_system_font_ex, (char *name, int type, int style,
00723                                  int w, int h, float depth, int start, int end));
00724 AGL_FUNC(void, allegro_gl_destroy_font, (FONT *f));
00725 AGL_FUNC(size_t, allegro_gl_list_font_textures, (FONT *f, GLuint *ids, size_t max_num_id));
00747 #if defined DOXYGEN  /* Is this a documentation scan? */
00748 
00755 #define AGL_DEFINE_PROC_TYPE
00756 
00757 #else
00758 
00759 AGL_FUNC(int, allegro_gl_is_extension_supported, (const char *));
00760 AGL_FUNC(void*, allegro_gl_get_proc_address, (const char *));
00761 
00762 #if defined ALLEGRO_WINDOWS
00763     #define AGL_DEFINE_PROC_TYPE(type, name, args) \
00764         typedef type (APIENTRY * name) args;
00765 #else
00766     #define AGL_DEFINE_PROC_TYPE(type, name, args) \
00767         typedef type (*name) args;
00768 #endif
00769 
00770 #endif
00771 
00793 AGL_FUNC(int, algl_do_dialog, (DIALOG *dialog, int focus_obj));
00794 AGL_FUNC(int, algl_popup_dialog, (DIALOG *dialog, int focus_obj));
00795 AGL_FUNC(void, algl_draw_mouse, (void));
00796 AGL_FUNC(void, algl_set_mouse_drawer, (void (*user_draw_mouse)(void)));
00797 AGL_FUNC(int, algl_alert, (AL_CONST char *s1, AL_CONST char *s2, AL_CONST char *s3,
00798                       AL_CONST char *b1, AL_CONST char *b2, int c1, int c2));
00799 AGL_FUNC(int, algl_alert3, (AL_CONST char *s1, AL_CONST char *s2, AL_CONST char *s3,
00800                        AL_CONST char *b1, AL_CONST char *b2, AL_CONST char *b3,
00801                        int c1, int c2, int c3));
00802 AGL_FUNC(int, d_algl_viewport_proc, (int msg, DIALOG *d, int c));
00803 
00808 #ifdef __cplusplus
00809 }
00810 #endif
00811 
00812 
00813 /* Fixes to MS's (or SGI?) broken GL headers */
00814 #ifdef GL_VERSION_1_1
00815 #ifndef GL_TEXTURE_BINDING_2D
00816 
00817 #ifdef GL_TEXTURE_2D_BINDING
00818 #define GL_TEXTURE_BINDING_2D GL_TEXTURE_2D_BINDING
00819 #endif
00820 
00821 #else
00822 
00823 #ifdef GL_TEXTURE_BINDING_2D
00824 #define GL_TEXTURE_2D_BINDING GL_TEXTURE_BINDING_2D
00825 #endif
00826 
00827 #endif
00828 
00829 #ifndef GL_TEXTURE_BINDING_2D
00830 #warning "GL_TEXTURE_BINDING_2D or GL_TEXTURE_2D_BINDING isn't defined by your"
00831 #warning "OpenGL headers. Make sure you have a genuine set of headers for"
00832 #warning "OpenGL 1.1 (or greater)"
00833 #endif
00834 #endif
00835 
00836 #endif
00837 

Generated on Mon Nov 12 11:05:31 2007 for AllegroGL by  doxygen 1.5.2