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
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
00023
00024 #endif
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
00033 #else
00034 #define _AGL_DLL
00035 #endif
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
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
00057
00058
00059 #define __glext_h_
00060 #define __glxext_h_
00061 #include <GL/gl.h>
00062 #undef __glext_h_
00063 #undef __glxext_h_
00064
00065 #endif
00066
00067
00068 #include "allegrogl/gl_ext.h"
00069
00070 #ifdef ALLEGRO_WITH_XWINDOWS
00071 #ifndef HAVE_LIBPTHREAD
00072 # error AllegroGL requires Allegro to have pthread support enabled!
00073 #endif
00074 #include <alleggl_config.h>
00075 #endif
00076
00077
00082 #define AGL_VERSION 0
00083 #define AGL_SUB_VERSION 4
00084 #define AGL_WIP_VERSION 1
00085 #define AGL_VERSION_STR "0.4.1"
00086
00089
00090 #if (ALLEGRO_VERSION < 4 || (ALLEGRO_VERSION == 4 && ALLEGRO_SUB_VERSION < 2))
00091 #error AllegroGL requires Allegro 4.2.0 or later to compile!
00092 #endif
00093 #ifndef GL_VERSION_1_1
00094 #error AllegroGL requires OpenGL 1.1 libraries or later to compile!
00095 #endif
00096
00097
00098 #ifdef __cplusplus
00099 extern "C" {
00100 #endif
00101
00102 #ifdef ALLEGRO_WINDOWS
00103
00104
00105 #ifndef PFD_SWAP_LAYER_BUFFERS
00106 #define PFD_SWAP_LAYER_BUFFERS 0x00000800
00107 #endif
00108
00109 #ifndef PFD_GENERIC_ACCELERATED
00110 #define PFD_GENERIC_ACCELERATED 0x00001000
00111 #endif
00112
00113 #ifndef PFD_SUPPORT_DIRECTDRAW
00114 #define PFD_SUPPORT_DIRECTDRAW 0x00002000
00115 #endif
00116
00117 #ifndef CDS_FULLSCREEN
00118 #define CDS_FULLSCREEN 0x00000004
00119 #endif
00120
00121 #ifndef ENUM_CURRENT_SETTINGS
00122 #define ENUM_CURRENT_SETTINGS ((DWORD)-1)
00123 #endif
00124
00125 #endif
00126
00127
00128 #define AGL_ERROR_SIZE 256
00129 AGL_VAR(char, allegro_gl_error[AGL_ERROR_SIZE]);
00130
00131
00141 AGL_FUNC(int, install_allegro_gl, (void));
00142 AGL_FUNC(void, remove_allegro_gl, (void));
00143
00144 AGL_FUNC(void, allegro_gl_flip, (void));
00145 AGL_FUNC(float, allegro_gl_opengl_version, (void));
00146
00155 #define allegro_gl_begin() ;
00156
00165 #define allegro_gl_end() ;
00166
00178 #define AGL_ALLEGRO_FORMAT 0x00000001
00179
00184 #define AGL_RED_DEPTH 0x00000002
00185
00190 #define AGL_GREEN_DEPTH 0x00000004
00191
00196 #define AGL_BLUE_DEPTH 0x00000008
00197
00203 #define AGL_ALPHA_DEPTH 0x00000010
00204
00208 #define AGL_COLOR_DEPTH 0x00000020
00209
00210
00216 #define AGL_ACC_RED_DEPTH 0x00000040
00217
00223 #define AGL_ACC_GREEN_DEPTH 0x00000080
00224
00225
00231 #define AGL_ACC_BLUE_DEPTH 0x00000100
00232
00233
00239 #define AGL_ACC_ALPHA_DEPTH 0x00000200
00240
00245 #define AGL_DOUBLEBUFFER 0x00000400
00246
00254 #define AGL_STEREO 0x00000800
00255
00256
00260 #define AGL_AUX_BUFFERS 0x00001000
00261
00262
00267 #define AGL_Z_DEPTH 0x00002000
00268
00269
00276 #define AGL_STENCIL_DEPTH 0x00004000
00277
00281 #define AGL_WINDOW_X 0x00008000
00282
00285 #define AGL_WINDOW_Y 0x00010000
00286
00295 #define AGL_RENDERMETHOD 0x00020000
00296
00300 #define AGL_FULLSCREEN 0x00040000
00301
00305 #define AGL_WINDOWED 0x00080000
00306
00322 #define AGL_VIDEO_MEMORY_POLICY 0x00100000
00323
00346 #define AGL_SAMPLE_BUFFERS 0x00200000
00347
00354 #define AGL_SAMPLES 0x00400000
00355
00360 #define AGL_FLOAT_COLOR 0x00800000
00361
00364 #define AGL_FLOAT_Z 0x01000000
00365
00366
00367
00368
00369
00370
00371 #define AGL_CONFIG_RESRVED 0xA000000
00372
00373
00376 #define AGL_DONTCARE 0
00377 #define AGL_SUGGEST -1
00378 #define AGL_REQUIRE -2
00379
00384 #define AGL_KEEP 1
00385 #define AGL_RELEASE 2
00386
00391 AGL_FUNC(void, allegro_gl_clear_settings, (void));
00392 AGL_FUNC(void, allegro_gl_set, (int option, int value));
00393 AGL_FUNC(int, allegro_gl_get, (int option));
00394 AGL_FUNC(void, allegro_gl_save_settings, (void));
00395 AGL_FUNC(void, allegro_gl_load_settings, (void));
00412 #if defined DOXYGEN
00413
00418 # define GFX_OPENGL_WINDOWED
00419
00420 # define GFX_OPENGL_FULLSCREEN
00421
00422 #define GFX_OPENGL
00423
00426 #else
00427
00428 #if defined ALLEGROGL_GENERIC_DRIVER
00429
00430
00431 #define GFX_OPENGL_WINDOWED AL_ID('O','G','L','W')
00432 #define GFX_OPENGL_FULLSCREEN AL_ID('O','G','L','F')
00433
00434 #else
00435 #if defined _WIN32
00436
00437 #define GFX_OPENGL_WINDOWED AL_ID('O','G','L','W')
00438 #define GFX_OPENGL_FULLSCREEN AL_ID('O','G','L','F')
00439
00440 #elif defined ALLEGROGL_HAVE_XF86VIDMODE
00441
00442 #define GFX_OPENGL_WINDOWED AL_ID('O','G','L','W')
00443 #define GFX_OPENGL_FULLSCREEN AL_ID('O','G','L','F')
00444
00445 #elif defined ALLEGRO_WITH_XWINDOWS
00446
00447 #define GFX_OPENGL_WINDOWED AL_ID('O','G','L','W')
00448
00449 #elif defined ALLEGRO_MACOSX
00450
00451 #define GFX_OPENGL_WINDOWED AL_ID('O','G','L','W')
00452 #define GFX_OPENGL_FULLSCREEN AL_ID('O','G','L','F')
00453
00454 #else
00455 #warning Unknown or unsupported platform.
00456 #endif
00457 #endif
00458
00459 #define GFX_OPENGL AL_ID('O','G','L','D')
00460
00461 #endif
00462
00463
00464
00465 extern GFX_DRIVER gfx_allegro_gl_default;
00466 #ifdef GFX_OPENGL_WINDOWED
00467 extern GFX_DRIVER gfx_allegro_gl_windowed;
00468 #endif
00469 #ifdef GFX_OPENGL_FULLSCREEN
00470 extern GFX_DRIVER gfx_allegro_gl_fullscreen;
00471 #endif
00472
00473
00481 AGL_FUNC(GLint, allegro_gl_set_video_bitmap_color_depth, (GLint bpp));
00493 AGL_FUNC(int, allegro_gl_use_mipmapping, (int enable));
00494 AGL_FUNC(int, allegro_gl_use_alpha_channel, (int enable));
00495 AGL_FUNC(int, allegro_gl_flip_texture, (int enable));
00496 AGL_FUNC(int, allegro_gl_check_texture, (BITMAP *bmp));
00497 AGL_FUNC(int, allegro_gl_check_texture_ex, (int flags, BITMAP *bmp,
00498 GLint internal_format));
00499 AGL_FUNC(GLint, allegro_gl_get_texture_format, (BITMAP *bmp));
00500 AGL_FUNC(GLint, allegro_gl_set_texture_format, (GLint format));
00501 AGL_FUNC(GLenum, allegro_gl_get_bitmap_type, (BITMAP *bmp));
00502 AGL_FUNC(GLenum, allegro_gl_get_bitmap_color_format, (BITMAP *bmp));
00503 AGL_FUNC(GLuint, allegro_gl_make_texture, (BITMAP *bmp));
00504 AGL_FUNC(GLuint, allegro_gl_make_masked_texture, (BITMAP *bmp));
00505 AGL_FUNC(GLuint, allegro_gl_make_texture_ex,(int flags, BITMAP *bmp,
00506 GLint internal_format));
00507
00508
00511 #define AGL_TEXTURE_MIPMAP 0x01
00512
00516 #define AGL_TEXTURE_HAS_ALPHA 0x02
00517
00522 #define AGL_TEXTURE_FLIP 0x04
00523
00527 #define AGL_TEXTURE_MASKED 0x08
00528
00533 #define AGL_TEXTURE_RESCALE 0x10
00534
00535
00538 #define AGL_TEXTURE_ALPHA_ONLY 0x20
00539
00550 AGL_FUNC(void, allegro_gl_set_allegro_mode, (void));
00551 AGL_FUNC(void, allegro_gl_unset_allegro_mode, (void));
00552 AGL_FUNC(void, allegro_gl_set_projection, (void));
00553 AGL_FUNC(void, allegro_gl_unset_projection, (void));
00567 AGL_FUNC(void, allegro_gl_MATRIX_to_GLfloat, (MATRIX *m, GLfloat gl[16]));
00568 AGL_FUNC(void, allegro_gl_MATRIX_to_GLdouble, (MATRIX *m, GLdouble gl[16]));
00569 AGL_FUNC(void, allegro_gl_MATRIX_f_to_GLfloat, (MATRIX_f *m, GLfloat gl[16]));
00570 AGL_FUNC(void, allegro_gl_MATRIX_f_to_GLdouble, (MATRIX_f *m, GLdouble gl[16]));
00571
00572 AGL_FUNC(void, allegro_gl_GLfloat_to_MATRIX, (GLfloat gl[16], MATRIX *m));
00573 AGL_FUNC(void, allegro_gl_GLdouble_to_MATRIX, (GLdouble gl[16], MATRIX *m));
00574 AGL_FUNC(void, allegro_gl_GLfloat_to_MATRIX_f, (GLfloat gl[16], MATRIX_f *m));
00575 AGL_FUNC(void, allegro_gl_GLdouble_to_MATRIX_f, (GLdouble gl[16], MATRIX_f *m));
00576
00581 AGL_FUNC(void, allegro_gl_apply_quat, (QUAT *q));
00582 AGL_FUNC(void, allegro_gl_quat_to_glrotatef, (QUAT *q, float *angle,
00583 float *x, float *y, float *z));
00584 AGL_FUNC(void, allegro_gl_quat_to_glrotated, (QUAT *q, double *angle,
00585 double *x, double *y, double *z));
00607
00611 #define AGL_FONT_TYPE_DONT_CARE -1
00612
00622 #define AGL_FONT_TYPE_BITMAP 0
00623
00634 #define AGL_FONT_TYPE_OUTLINE 1
00635
00646 #define AGL_FONT_TYPE_TEXTURED 2
00647
00648
00649
00654 #define AGL_FONT_STYLE_BOLD 1
00655
00659 #define AGL_FONT_STYLE_BLACK 2
00660
00664 #define AGL_FONT_STYLE_ITALIC 4
00665
00669 #define AGL_FONT_STYLE_UNDERLINE 8
00670
00674 #define AGL_FONT_STYLE_STRIKEOUT 16
00675
00681 #define AGL_FONT_STYLE_ANTI_ALIASED 32
00682
00689 #define AGL_FONT_POLYGONS 1
00690
00691
00698 #define AGL_FONT_LINES 2
00699
00700
00701 AGL_FUNC(int, allegro_gl_printf, (AL_CONST FONT *f, float x, float y, float z,
00702 int color, AL_CONST char *format, ...));
00703 AGL_FUNC(int, allegro_gl_printf_ex, (AL_CONST FONT *f, float x, float y, float z,
00704 AL_CONST char *format, ...));
00705 AGL_FUNC(FONT*, allegro_gl_convert_allegro_font, (FONT *f, int type, float scale));
00706 AGL_FUNC(FONT*, allegro_gl_convert_allegro_font_ex, (FONT *f, int type, float scale,
00707 GLint format));
00708
00709 AGL_FUNC(void, allegro_gl_set_font_generation_mode, (int mode));
00710 AGL_FUNC(FONT*, allegro_gl_load_system_font, (char *name, int style, int w, int h));
00711 AGL_FUNC(FONT*, allegro_gl_load_system_font_ex, (char *name, int type, int style,
00712 int w, int h, float depth, int start, int end));
00713 AGL_FUNC(void, allegro_gl_destroy_font, (FONT *f));
00714 AGL_FUNC(size_t, allegro_gl_list_font_textures, (FONT *f, GLuint *ids, size_t max_num_id));
00736 #if defined DOXYGEN
00737
00744 #define AGL_DEFINE_PROC_TYPE
00745
00746 #else
00747
00748 AGL_FUNC(int, allegro_gl_is_extension_supported, (const char *));
00749 AGL_FUNC(void*, allegro_gl_get_proc_address, (const char *));
00750
00751 #if defined ALLEGRO_WINDOWS
00752 #define AGL_DEFINE_PROC_TYPE(type, name, args) \
00753 typedef type (APIENTRY * name) args;
00754 #else
00755 #define AGL_DEFINE_PROC_TYPE(type, name, args) \
00756 typedef type (*name) args;
00757 #endif
00758
00759 #endif
00760
00782 AGL_FUNC(int, algl_do_dialog, (DIALOG *dialog, int focus_obj));
00783 AGL_FUNC(int, algl_popup_dialog, (DIALOG *dialog, int focus_obj));
00784 AGL_FUNC(void, algl_draw_mouse, (void));
00785 AGL_FUNC(void, algl_set_mouse_drawer, (void (*user_draw_mouse)(void)));
00786 AGL_FUNC(int, algl_alert, (AL_CONST char *s1, AL_CONST char *s2, AL_CONST char *s3,
00787 AL_CONST char *b1, AL_CONST char *b2, int c1, int c2));
00788 AGL_FUNC(int, algl_alert3, (AL_CONST char *s1, AL_CONST char *s2, AL_CONST char *s3,
00789 AL_CONST char *b1, AL_CONST char *b2, AL_CONST char *b3,
00790 int c1, int c2, int c3));
00791 AGL_FUNC(int, d_algl_viewport_proc, (int msg, DIALOG *d, int c));
00792
00797 #ifdef __cplusplus
00798 }
00799 #endif
00800
00801
00802
00803 #ifdef GL_VERSION_1_1
00804 #ifndef GL_TEXTURE_BINDING_2D
00805
00806 #ifdef GL_TEXTURE_2D_BINDING
00807 #define GL_TEXTURE_BINDING_2D GL_TEXTURE_2D_BINDING
00808 #endif
00809
00810 #else
00811
00812 #ifdef GL_TEXTURE_BINDING_2D
00813 #define GL_TEXTURE_2D_BINDING GL_TEXTURE_BINDING_2D
00814 #endif
00815
00816 #endif
00817
00818 #ifndef GL_TEXTURE_BINDING_2D
00819 #warning "GL_TEXTURE_BINDING_2D or GL_TEXTURE_2D_BINDING isn't defined by your"
00820 #warning "OpenGL headers. Make sure you have a genuine set of headers for"
00821 #warning "OpenGL 1.1 (or greater)"
00822 #endif
00823 #endif
00824
00825 #endif
00826