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 #include <winalleg.h>
00018 
00019 #ifdef WIN32_LEAN_AND_MEAN_defined
00020 #undef WIN32_LEAN_AND_MEAN_defined
00021 #undef WIN32_LEAN_AND_MEAN
00022 #endif /* WIN32_LEAN_AND_MEAN_defined */
00023 
00024 #endif /* ALLEGRO_WINDOWS */
00025 
00026 
00027 #if (defined ALLEGRO_GL_DYNAMIC) && (defined ALLEGRO_WINDOWS)
00028     #ifdef ALLEGRO_GL_SRC_BUILD
00029         #define _AGL_DLL __declspec(dllexport)
00030     #else
00031         #define _AGL_DLL __declspec(dllimport)
00032     #endif /* ALLEGRO_GL_SRC_BUILD */
00033 #else
00034     #define _AGL_DLL
00035 #endif /* (defined ALLEGRO_GL_DYNAMIC) && (defined ALLEGRO_WINDOWS) */
00036 
00037 #define AGL_VAR(type, name) extern _AGL_DLL type name
00038 
00039 #if (defined ALLEGRO_GL_DYNAMIC) && (defined ALLEGRO_WINDOWS)
00040     #define AGL_FUNC(type, name, args) extern _AGL_DLL type __cdecl name args
00041 #else
00042     #define AGL_FUNC(type, name, args) extern type name args
00043 #endif /* (defined ALLEGRO_GL_DYNAMIC) && (defined ALLEGRO_WINDOWS) */
00044 
00045 
00046 #ifdef ALLEGRO_MACOSX
00047 
00048 #include <OpenGL/OpenGL.h>
00049 #include <OpenGL/gl.h>
00050 #include <OpenGL/glext.h>
00051 
00052 #ifndef GL_GLEXT_PROTOTYPES
00053 #define GL_GLEXT_PROTOTYPES
00054 #endif
00055 
00056 #else /* ALLEGRO_MACOSX */
00057 
00058 /* HACK: Prevent both Mesa and SGI's broken headers from screwing us */
00059 #define __glext_h_
00060 #define __glxext_h_
00061 #include <GL/gl.h>
00062 #undef  __glext_h_
00063 #undef  __glxext_h_
00064 
00065 #endif /* ALLEGRO_MACOSX */
00066 
00067 
00068 #include "allegrogl/gl_ext.h"
00069 
00070 #ifdef ALLEGRO_WITH_XWINDOWS
00071 #if (ALLEGRO_SUB_VERSION == 2) && (ALLEGRO_WIP_VERSION < 2)
00072 #   ifndef HAVE_LIBPTHREAD
00073 #      error AllegroGL requires Allegro to have pthread support enabled!
00074 #   endif
00075 #else
00076 #   ifndef ALLEGRO_HAVE_LIBPTHREAD
00077 #      error AllegroGL requires Allegro to have pthread support enabled!
00078 #   endif
00079 #endif
00080 #include <alleggl_config.h>
00081 #endif
00082 
00083 
00088 #define AGL_VERSION     0            
00089 #define AGL_SUB_VERSION 4            
00090 #define AGL_WIP_VERSION 3            
00091 #define AGL_VERSION_STR "0.4.3"      
00092 
00095 /* Version Check */
00096 #if (ALLEGRO_VERSION < 4 || (ALLEGRO_VERSION == 4 && ALLEGRO_SUB_VERSION < 2))
00097     #error AllegroGL requires Allegro 4.2.0 or later to compile!
00098 #endif
00099 #ifndef GL_VERSION_1_1
00100     #error AllegroGL requires OpenGL 1.1 libraries or later to compile!
00101 #endif
00102 
00103 
00104 #ifdef __cplusplus
00105 extern "C" {
00106 #endif
00107 
00108 #ifdef ALLEGRO_WINDOWS
00109     
00110 /* Missing #defines from Mingw */
00111 #ifndef PFD_SWAP_LAYER_BUFFERS
00112 #define PFD_SWAP_LAYER_BUFFERS  0x00000800
00113 #endif
00114 
00115 #ifndef PFD_GENERIC_ACCELERATED
00116 #define PFD_GENERIC_ACCELERATED 0x00001000
00117 #endif
00118 
00119 #ifndef PFD_SUPPORT_DIRECTDRAW
00120 #define PFD_SUPPORT_DIRECTDRAW  0x00002000
00121 #endif
00122 
00123 #ifndef CDS_FULLSCREEN
00124 #define CDS_FULLSCREEN      0x00000004
00125 #endif
00126 
00127 #ifndef ENUM_CURRENT_SETTINGS
00128 #define ENUM_CURRENT_SETTINGS       ((DWORD)-1)
00129 #endif
00130 
00131 #endif
00132 
00133 
00134 #define AGL_ERROR_SIZE 256
00135 AGL_VAR(char, allegro_gl_error[AGL_ERROR_SIZE]);
00136 
00137 
00147 AGL_FUNC(int, install_allegro_gl, (void));
00148 AGL_FUNC(void, remove_allegro_gl, (void));
00149 
00150 AGL_FUNC(void, allegro_gl_flip, (void));
00151 AGL_FUNC(float, allegro_gl_opengl_version, (void));
00152 
00161 #define allegro_gl_begin() ;
00162 
00171 #define allegro_gl_end() ;
00172 
00184 #define AGL_ALLEGRO_FORMAT  0x00000001
00185 
00190 #define AGL_RED_DEPTH       0x00000002
00191 
00196 #define AGL_GREEN_DEPTH     0x00000004
00197 
00202 #define AGL_BLUE_DEPTH      0x00000008
00203 
00209 #define AGL_ALPHA_DEPTH     0x00000010
00210 
00214 #define AGL_COLOR_DEPTH     0x00000020
00215 
00216 
00222 #define AGL_ACC_RED_DEPTH   0x00000040
00223 
00229 #define AGL_ACC_GREEN_DEPTH 0x00000080
00230 
00231 
00237 #define AGL_ACC_BLUE_DEPTH  0x00000100
00238 
00239 
00245 #define AGL_ACC_ALPHA_DEPTH 0x00000200
00246 
00251 #define AGL_DOUBLEBUFFER    0x00000400
00252 
00260 #define AGL_STEREO          0x00000800
00261 
00262 
00266 #define AGL_AUX_BUFFERS     0x00001000
00267 
00268 
00273 #define AGL_Z_DEPTH         0x00002000
00274 
00275 
00282 #define AGL_STENCIL_DEPTH   0x00004000
00283 
00287 #define AGL_WINDOW_X        0x00008000
00288 
00291 #define AGL_WINDOW_Y        0x00010000
00292 
00301 #define AGL_RENDERMETHOD    0x00020000
00302 
00306 #define AGL_FULLSCREEN      0x00040000
00307 
00311 #define AGL_WINDOWED        0x00080000
00312 
00328 #define AGL_VIDEO_MEMORY_POLICY     0x00100000
00329 
00352 #define AGL_SAMPLE_BUFFERS  0x00200000
00353 
00360 #define AGL_SAMPLES        0x00400000
00361 
00366 #define AGL_FLOAT_COLOR    0x00800000
00367 
00370 #define AGL_FLOAT_Z        0x01000000
00371 
00372 
00373 
00374 /* XXX <rohannessian> I'm reserving 2 bits here for later expansion. DO NOT USE
00375  * without consulting me first.
00376  */
00377 #define AGL_CONFIG_RESRVED 0xA000000
00378 
00379 
00382 #define AGL_DONTCARE   0 
00383 #define AGL_SUGGEST   -1 
00384 #define AGL_REQUIRE   -2 
00385 
00390 #define AGL_KEEP    1 
00391 #define AGL_RELEASE 2 
00392 
00397 AGL_FUNC(void, allegro_gl_clear_settings, (void));
00398 AGL_FUNC(void, allegro_gl_set, (int option, int value));
00399 AGL_FUNC(int,  allegro_gl_get, (int option));
00400 AGL_FUNC(void, allegro_gl_save_settings, (void));
00401 AGL_FUNC(void, allegro_gl_load_settings, (void));
00418 #if defined DOXYGEN  /* Is this a documentation scan? */
00419 
00424 # define GFX_OPENGL_WINDOWED
00425 
00426 # define GFX_OPENGL_FULLSCREEN
00427 
00428   #define GFX_OPENGL
00429 
00432 #else
00433 
00434 #if defined ALLEGROGL_GENERIC_DRIVER
00435   /* Allegro is able to determine at run-time if windowed or fullscreen modes
00436      are available */
00437   #define GFX_OPENGL_WINDOWED               AL_ID('O','G','L','W')
00438   #define GFX_OPENGL_FULLSCREEN             AL_ID('O','G','L','F')
00439 
00440 #else
00441 #if defined _WIN32
00442   /* Windows always supports fullscreen */
00443   #define GFX_OPENGL_WINDOWED               AL_ID('O','G','L','W')
00444   #define GFX_OPENGL_FULLSCREEN             AL_ID('O','G','L','F')
00445 
00446 #elif defined ALLEGROGL_HAVE_XF86VIDMODE
00447   /* X fullscreen support only works with the XF86 VidMode extension */
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 ALLEGRO_WITH_XWINDOWS
00452   /* Plain X only supports windowed modes */
00453   #define GFX_OPENGL_WINDOWED               AL_ID('O','G','L','W')
00454   
00455 #elif defined ALLEGRO_MACOSX
00456   /* MacOS X always supports fullscreen */
00457   #define GFX_OPENGL_WINDOWED               AL_ID('O','G','L','W')
00458   #define GFX_OPENGL_FULLSCREEN             AL_ID('O','G','L','F')
00459 
00460 #else
00461   #warning Unknown or unsupported platform.
00462 #endif
00463 #endif
00464 
00465 #define GFX_OPENGL                  AL_ID('O','G','L','D')
00466 
00467 #endif
00468 
00469 
00470 /* Declare graphics driver objects */
00471 extern GFX_DRIVER gfx_allegro_gl_default;
00472 #ifdef GFX_OPENGL_WINDOWED
00473 extern GFX_DRIVER gfx_allegro_gl_windowed;
00474 #endif
00475 #ifdef GFX_OPENGL_FULLSCREEN
00476 extern GFX_DRIVER gfx_allegro_gl_fullscreen;
00477 #endif
00478 
00479 
00487 AGL_FUNC(GLint, allegro_gl_set_video_bitmap_color_depth, (int bpp));
00499 AGL_FUNC(int, allegro_gl_use_mipmapping, (int enable));
00500 AGL_FUNC(int, allegro_gl_use_alpha_channel, (int enable));
00501 AGL_FUNC(int, allegro_gl_flip_texture, (int enable));
00502 AGL_FUNC(int, allegro_gl_check_texture, (BITMAP *bmp));
00503 AGL_FUNC(int, allegro_gl_check_texture_ex, (int flags, BITMAP *bmp,
00504                                        GLint internal_format));
00505 AGL_FUNC(GLint, allegro_gl_get_texture_format, (BITMAP *bmp));
00506 AGL_FUNC(GLint, allegro_gl_set_texture_format, (GLint format));
00507 AGL_FUNC(GLenum, allegro_gl_get_bitmap_type, (BITMAP *bmp));
00508 AGL_FUNC(GLenum, allegro_gl_get_bitmap_color_format, (BITMAP *bmp));
00509 AGL_FUNC(GLuint, allegro_gl_make_texture, (BITMAP *bmp));
00510 AGL_FUNC(GLuint, allegro_gl_make_masked_texture, (BITMAP *bmp));
00511 AGL_FUNC(GLuint, allegro_gl_make_texture_ex,(int flags, BITMAP *bmp,
00512                                          GLint internal_format));
00513 
00514 
00517 #define AGL_TEXTURE_MIPMAP      0x01
00518 
00522 #define AGL_TEXTURE_HAS_ALPHA   0x02
00523 
00528 #define AGL_TEXTURE_FLIP        0x04
00529 
00533 #define AGL_TEXTURE_MASKED      0x08
00534 
00539 #define AGL_TEXTURE_RESCALE     0x10
00540 
00541 
00544 #define AGL_TEXTURE_ALPHA_ONLY  0x20
00545 
00556 AGL_FUNC(void, allegro_gl_set_allegro_mode, (void));
00557 AGL_FUNC(void, allegro_gl_unset_allegro_mode, (void));
00558 AGL_FUNC(void, allegro_gl_set_projection, (void));
00559 AGL_FUNC(void, allegro_gl_unset_projection, (void));
00573 AGL_FUNC(void, allegro_gl_MATRIX_to_GLfloat, (MATRIX *m, GLfloat gl[16]));
00574 AGL_FUNC(void, allegro_gl_MATRIX_to_GLdouble, (MATRIX *m, GLdouble gl[16]));
00575 AGL_FUNC(void, allegro_gl_MATRIX_f_to_GLfloat, (MATRIX_f *m, GLfloat gl[16]));
00576 AGL_FUNC(void, allegro_gl_MATRIX_f_to_GLdouble, (MATRIX_f *m, GLdouble gl[16]));
00577 
00578 AGL_FUNC(void, allegro_gl_GLfloat_to_MATRIX, (GLfloat gl[16], MATRIX *m));
00579 AGL_FUNC(void, allegro_gl_GLdouble_to_MATRIX, (GLdouble gl[16], MATRIX *m));
00580 AGL_FUNC(void, allegro_gl_GLfloat_to_MATRIX_f, (GLfloat gl[16], MATRIX_f *m));
00581 AGL_FUNC(void, allegro_gl_GLdouble_to_MATRIX_f, (GLdouble gl[16], MATRIX_f *m));
00582 
00587 AGL_FUNC(void, allegro_gl_apply_quat, (QUAT *q));
00588 AGL_FUNC(void, allegro_gl_quat_to_glrotatef, (QUAT *q, float *angle,
00589                                          float *x, float *y, float *z));
00590 AGL_FUNC(void, allegro_gl_quat_to_glrotated, (QUAT *q, double *angle,
00591                                          double *x, double *y, double *z));
00613 /* These define the supported font types */
00617 #define AGL_FONT_TYPE_DONT_CARE     -1
00618 
00628 #define AGL_FONT_TYPE_BITMAP         0
00629 
00640 #define AGL_FONT_TYPE_OUTLINE        1
00641 
00652 #define AGL_FONT_TYPE_TEXTURED       2
00653 
00654 
00655 /* These defines the font styles for system generated fonts */
00660 #define AGL_FONT_STYLE_BOLD          1
00661 
00665 #define AGL_FONT_STYLE_BLACK         2
00666 
00670 #define AGL_FONT_STYLE_ITALIC        4
00671 
00675 #define AGL_FONT_STYLE_UNDERLINE     8
00676 
00680 #define AGL_FONT_STYLE_STRIKEOUT    16
00681 
00687 #define AGL_FONT_STYLE_ANTI_ALIASED 32
00688 
00695 #define AGL_FONT_POLYGONS 1
00696 
00697 
00704 #define AGL_FONT_LINES    2
00705 
00706 
00707 AGL_FUNC(int, allegro_gl_printf, (AL_CONST FONT *f, float x, float y, float z,
00708                              int color, AL_CONST char *format, ...));
00709 AGL_FUNC(int, allegro_gl_printf_ex, (AL_CONST FONT *f, float x, float y, float z,
00710                              AL_CONST char *format, ...));
00711 AGL_FUNC(FONT*, allegro_gl_convert_allegro_font, (FONT *f, int type, float scale));
00712 AGL_FUNC(FONT*, allegro_gl_convert_allegro_font_ex, (FONT *f, int type, float scale,
00713                                                 GLint format));
00714 
00715 AGL_FUNC(void, allegro_gl_set_font_generation_mode, (int mode));
00716 AGL_FUNC(FONT*, allegro_gl_load_system_font, (char *name, int style, int w, int h));
00717 AGL_FUNC(FONT*, allegro_gl_load_system_font_ex, (char *name, int type, int style,
00718                                  int w, int h, float depth, int start, int end));
00719 AGL_FUNC(void, allegro_gl_destroy_font, (FONT *f));
00720 AGL_FUNC(size_t, allegro_gl_list_font_textures, (FONT *f, GLuint *ids, size_t max_num_id));
00742 #if defined DOXYGEN  /* Is this a documentation scan? */
00743 
00750 #define AGL_DEFINE_PROC_TYPE
00751 
00752 #else
00753 
00754 AGL_FUNC(int, allegro_gl_is_extension_supported, (const char *));
00755 AGL_FUNC(void*, allegro_gl_get_proc_address, (const char *));
00756 
00757 #if defined ALLEGRO_WINDOWS
00758     #define AGL_DEFINE_PROC_TYPE(type, name, args) \
00759         typedef type (APIENTRY * name) args;
00760 #else
00761     #define AGL_DEFINE_PROC_TYPE(type, name, args) \
00762         typedef type (*name) args;
00763 #endif
00764 
00765 #endif
00766 
00788 AGL_FUNC(int, algl_do_dialog, (DIALOG *dialog, int focus_obj));
00789 AGL_FUNC(int, algl_popup_dialog, (DIALOG *dialog, int focus_obj));
00790 AGL_FUNC(void, algl_draw_mouse, (void));
00791 AGL_FUNC(void, algl_set_mouse_drawer, (void (*user_draw_mouse)(void)));
00792 AGL_FUNC(int, algl_alert, (AL_CONST char *s1, AL_CONST char *s2, AL_CONST char *s3,
00793                       AL_CONST char *b1, AL_CONST char *b2, int c1, int c2));
00794 AGL_FUNC(int, algl_alert3, (AL_CONST char *s1, AL_CONST char *s2, AL_CONST char *s3,
00795                        AL_CONST char *b1, AL_CONST char *b2, AL_CONST char *b3,
00796                        int c1, int c2, int c3));
00797 AGL_FUNC(int, d_algl_viewport_proc, (int msg, DIALOG *d, int c));
00798 
00803 #ifdef __cplusplus
00804 }
00805 #endif
00806 
00807 
00808 /* Fixes to MS's (or SGI?) broken GL headers */
00809 #ifdef GL_VERSION_1_1
00810 #ifndef GL_TEXTURE_BINDING_2D
00811 
00812 #ifdef GL_TEXTURE_2D_BINDING
00813 #define GL_TEXTURE_BINDING_2D GL_TEXTURE_2D_BINDING
00814 #endif
00815 
00816 #else
00817 
00818 #ifdef GL_TEXTURE_BINDING_2D
00819 #define GL_TEXTURE_2D_BINDING GL_TEXTURE_BINDING_2D
00820 #endif
00821 
00822 #endif
00823 
00824 #ifndef GL_TEXTURE_BINDING_2D
00825 #warning "GL_TEXTURE_BINDING_2D or GL_TEXTURE_2D_BINDING isn't defined by your"
00826 #warning "OpenGL headers. Make sure you have a genuine set of headers for"
00827 #warning "OpenGL 1.1 (or greater)"
00828 #endif
00829 #endif
00830 
00831 #endif
00832 

Generated on Sun Nov 11 15:52:54 2007 for AllegroGL by  doxygen 1.5.2