1 #ifndef gf_included_allglint_h
2 #define gf_included_allglint_h
3 
4 #include "alleggl.h"
5 
6 
7 struct allegro_gl_info {
8 	float version;          /* OpenGL version */
9 	int num_texture_units;  /* Number of texture units */
10 	int max_texture_size;   /* Maximum texture size */
11 	int is_voodoo3_and_under; /* Special cases for Voodoo 1-3 */
12 	int is_voodoo;          /* Special cases for Voodoo cards */
13 	int is_matrox_g200;     /* Special cases for Matrox G200 boards */
14 	int is_ati_rage_pro;    /* Special cases for ATI Rage Pro boards */
15 	int is_ati_radeon_7000; /* Special cases for ATI Radeon 7000 */
16 	int is_ati_r200_chip;	/* Special cases for ATI card with chip R200 */
17 	int is_mesa_driver;     /* Special cases for MESA */
18 };
19 
20 
21 
22 struct allegro_gl_driver {
23 	void (*flip) (void);
24 	void (*gl_on) (void);
25 	void (*gl_off) (void);
26 	void (*screen_masked_blit)(struct BITMAP *source, int source_x,
27 	                           int source_y, int dest_x, int dest_y,
28 	                           int width, int height, int flip_dir,
29 	                           int blit_type);
30 };
31 
32 
33 
34 struct allegro_gl_rgba_size {
35 	int r, g, b, a;
36 };
37 
38 
39 
40 struct allegro_gl_indexed_size {
41 	int bpp;
42 };
43 
44 
45 
46 union allegro_gl_pixel_size {
47 	struct allegro_gl_rgba_size rgba;
48 	struct allegro_gl_indexed_size indexed;
49 };
50 
51 
52 
53 struct allegro_gl_display_info {
54 	int allegro_format;
55 	union allegro_gl_pixel_size pixel_size;
56 	int colour_depth;
57 	union allegro_gl_pixel_size accum_size;
58 	int doublebuffered;
59 	int stereo;
60 	int aux_buffers;
61 	int depth_size;
62 	int stencil_size;
63 	int w, h, x, y;
64 	int r_shift, g_shift, b_shift, a_shift;
65 	int packed_pixel_type, packed_pixel_format;
66 	int rmethod; /* type of rendering, 0: software; 1: hardware, 2: unknown (X Win) */
67 	int fullscreen;
68 	int vidmem_policy;
69 	int sample_buffers;
70 	int samples;
71 	int float_color;
72 	int float_depth;
73 };
74 
75 extern struct allegro_gl_display_info allegro_gl_display_info;
76 extern struct allegro_gl_driver *__allegro_gl_driver;
77 extern struct allegro_gl_info allegro_gl_info;
78 extern int __allegro_gl_required_settings, __allegro_gl_suggested_settings;
79 extern int __allegro_gl_valid_context;
80 extern int __allegro_gl_use_alpha;
81 extern GLint __allegro_gl_texture_read_format[5];
82 extern GLint __allegro_gl_texture_components[5];
83 
84 #ifdef ALLEGRO_WINDOWS
85 extern HDC __allegro_gl_hdc;
86 #endif
87 
88 int __allegro_gl_make_power_of_2(int x);
89 
90 void __allegro_gl_reset_scorer (void);
91 int __allegro_gl_score_config (int refnum, struct allegro_gl_display_info *dinfo);
92 int __allegro_gl_best_config (void);
93 
94 void __allegro_gl_set_allegro_image_format (int big_endian);
95 
96 void __allegro_gl_fill_in_info(void);
97 
98 void __allegro_gl_manage_extensions(void);
99 void __allegro_gl_unmanage_extensions(void);
100 void __allegro_gl_print_extensions(const char * extension);
101 int __allegro_gl_look_for_an_extension(AL_CONST char *name,
102                                                   AL_CONST GLubyte * extensions);
103 
104 
105 extern _DRIVER_INFO *(*saved_gfx_drivers) (void);
106 
107 typedef void (* BLIT_BETWEEN_FORMATS_FUNC) (struct BITMAP*, struct BITMAP*, int, int, int, int, int, int);
108 extern BLIT_BETWEEN_FORMATS_FUNC __blit_between_formats8;
109 extern BLIT_BETWEEN_FORMATS_FUNC __blit_between_formats15;
110 extern BLIT_BETWEEN_FORMATS_FUNC __blit_between_formats16;
111 extern BLIT_BETWEEN_FORMATS_FUNC __blit_between_formats24;
112 extern BLIT_BETWEEN_FORMATS_FUNC __blit_between_formats32;
113 
114 void allegro_gl_memory_blit_between_formats(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height);
115 
116 int allegro_gl_set_mouse_sprite(BITMAP *sprite, int xfocus, int yfocus);
117 int allegro_gl_show_mouse(BITMAP* bmp, int x, int y);
118 void allegro_gl_hide_mouse(void);
119 void allegro_gl_move_mouse(int x, int y);
120 
121 
122 extern char const *__allegro_gl_get_format_description(GLint format);
123 extern int __allegro_gl_get_num_channels(GLenum format);
124 extern GLenum __allegro_gl_get_bitmap_type(BITMAP *bmp, int flags);
125 extern GLenum __allegro_gl_get_bitmap_color_format(BITMAP *bmp, int flags);
126 extern GLint __allegro_gl_get_texture_format_ex(BITMAP *bmp, int flags);
127 extern BITMAP *__allegro_gl_munge_bitmap(int flags, BITMAP *bmp, int x, int y,
128                                       int w, int h, GLint *type, GLint *format);
129 
130 extern int __allegro_gl_blit_operation;
131 
132 
133 /** \internal
134  * Stores info about a glyph before rendering
135  */
136 typedef struct AGL_GLYPH {
137 	int glyph_num;
138 	int x, y, w, h;
139 	int offset_x, offset_y, offset_w, offset_h;
140 } AGL_GLYPH;
141 
142 
143 /*   <ofs_x>
144      +--------------------+
145      |                    |
146      |    +-------+       |
147      |    | glyph |       |
148      |    +-------+       |
149      |                    |
150      +--------------------+
151           <   w   ><ofs_w >
152      <      polygon       >
153 */
154 
155 
156 /** \internal
157  * Part of the Allegro font vtable's data field.
158  * Contains all the info needed to manage the 3D font.
159  */
160 typedef struct FONT_AGL_DATA {
161 	int type;
162 	int start, end;
163 	int is_free_chunk;
164 
165 	float scale;
166 	GLint format;
167 
168 	void *data;
169 	AGL_GLYPH *glyph_coords;
170 	GLuint list_base;
171 	GLuint texture;
172 
173 	struct FONT_AGL_DATA *next;
174 
175         int has_alpha;
176 } FONT_AGL_DATA;
177 
178 extern struct FONT_VTABLE *font_vtable_agl;
179 
180 
181 /** \internal
182  *  Force the creation of an alpha channel in the texture that will be generated
183  *  by allegro_gl_make_texture_ex()
184  */
185 #define AGL_TEXTURE_FORCE_ALPHA_INTERNAL 0x80000000
186 
187 /** \internal
188  *  Checks for texture validity only. Used by allegro_gl_check_texture() only.
189  */
190 #define AGL_TEXTURE_CHECK_VALID_INTERNAL 0x40000000
191 
192 
193 #define AGL_OP_LOGIC_OP			0x0
194 #define AGL_OP_BLEND			0x1
195 
196 #define AGL_H_FLIP		1	/* Flag to request horizontal flipping */
197 #define AGL_V_FLIP		2	/* Flag to request vertical flipping */
198 #define AGL_REGULAR_BMP	1	/* Must be set for bitmaps that are not sprites.
199 							   Otherwise the clipping routine will not test
200 							   if source_x and source_y are legal values */
201 #define AGL_NO_ROTATION	2	/* If not set the clipping routine is skipped
202 							   This is needed for pivot_scaled_x() in order
203 							   not to clip rotated bitmaps (in such a case
204 							   OpenGL will take care of it) */
205 
206 
207 #define AGL_LOG(level,str)
208 
209 #ifdef DEBUGMODE
210 #ifdef LOGLEVEL
211 
212 void __allegro_gl_log (int level, const char *str);
213 #undef AGL_LOG
214 #define AGL_LOG(level,str) __allegro_gl_log (level, str)
215 
216 
217 #endif
218 #endif
219 
220 
221 #define GET_ALLEGRO_VERSION() MAKE_VER(ALLEGRO_VERSION, ALLEGRO_SUB_VERSION, \
222                                        ALLEGRO_WIP_VERSION)
223 #define MAKE_VER(a, b, c) (((a) << 16) | ((b) << 8) | (c))
224 
225 
226 #endif
227 
228