]> icculus.org git repositories - btb/d2x.git/blob - include/ogl_init.h
typo
[btb/d2x.git] / include / ogl_init.h
1 /* interface to OpenGL functions
2  * Added 9/15/99 Matthew Mueller
3  * Got rid of OpenGL-internal stuff 2004-5-16 Martin Schaffner
4  */
5
6 #ifndef _OGL_INIT_H_ 
7 #define _OGL_INIT_H_
8
9 #ifdef _MSC_VER
10 # undef MAC // dirty feckin hack
11 #include <windows.h>
12 #include <stddef.h>
13 # define MAC(x)
14 #endif
15
16 //#ifdef _WIN32
17 //#define OGL_RUNTIME_LOAD
18 //#endif
19
20 #ifdef OGL_RUNTIME_LOAD
21 #include "loadgl.h"
22 int ogl_init_load_library(void);
23 #else
24 #define GL_GLEXT_LEGACY
25 #undef GL_ARB_multitexture
26 #if defined(__APPLE__) && defined(__MACH__)
27 #include <OpenGL/gl.h>
28 #else
29 #include <GL/gl.h>
30 #endif
31 #endif
32
33 #ifndef GL_VERSION_1_1
34 #ifdef GL_EXT_texture
35 #define GL_INTENSITY4 GL_INTENSITY4_EXT
36 #define GL_INTENSITY8 GL_INTENSITY8_EXT
37 #endif
38 #endif
39
40 #include "gr.h"
41 #include "palette.h"
42 #include "pstypes.h"
43
44 /* we need to export ogl_texture for 2d/font.c */
45 typedef struct _ogl_texture {
46         GLuint handle;
47         GLint internalformat;
48         GLenum format;
49         int w,h,tw,th,lw;
50         int bytesu;
51         int bytes;
52         GLfloat u,v;
53         GLfloat prio;
54         int wrapstate[2];
55         fix lastrend;
56         unsigned long numrend;
57         char wantmip;
58 } ogl_texture;
59
60 extern ogl_texture* ogl_get_free_texture();
61
62 extern int ogl_alttexmerge;//merge textures by just printing the seperate textures?
63 extern int ogl_rgba_format;
64 extern int ogl_setgammaramp_ok;
65 extern int ogl_intensity4_ok;
66 extern int ogl_luminance4_alpha4_ok;
67 extern int ogl_rgba2_ok;
68 extern int ogl_readpixels_ok;
69 extern int ogl_gettexlevelparam_ok;
70
71 #ifndef EXT_texture_env_combine
72 #define EXT_texture_env_combine 1
73 #define GL_COMBINE_RGB_EXT                0x8571
74 #define GL_COMBINE_ALPHA_EXT              0x8572
75 #define GL_PRIMARY_COLOR_EXT              0x8577
76 #define GL_PREVIOUS_EXT                   0x8578
77 #define GL_SOURCE0_RGB_EXT                0x8580
78 #define GL_SOURCE1_RGB_EXT                0x8581
79 #define GL_SOURCE2_RGB_EXT                0x8582
80 #define GL_SOURCE0_ALPHA_EXT              0x8588
81 #define GL_SOURCE1_ALPHA_EXT              0x8589
82 #define GL_SOURCE2_ALPHA_EXT              0x858A
83 #define GL_OPERAND0_RGB_EXT               0x8590
84 #define GL_OPERAND1_RGB_EXT               0x8591
85 #define GL_OPERAND2_RGB_EXT               0x8592
86 #define GL_OPERAND0_ALPHA_EXT             0x8598
87 #define GL_OPERAND1_ALPHA_EXT             0x8599
88 #define GL_OPERAND2_ALPHA_EXT             0x859A
89 #endif
90
91 #ifndef GL_NV_texture_env_combine4
92 #define GL_NV_texture_env_combine4 1
93 #define GL_COMBINE4_NV                    0x8503
94 #define GL_SOURCE3_RGB_NV                 0x8583
95 #define GL_SOURCE3_ALPHA_NV               0x858B
96 #define GL_OPERAND3_RGB_NV                0x8593
97 #define GL_OPERAND3_ALPHA_NV              0x859B
98 #endif
99 extern int ogl_nv_texture_env_combine4_ok;
100
101 #ifndef GL_EXT_texture_filter_anisotropic
102 #define GL_EXT_texture_filter_anisotropic 1
103 #define GL_TEXTURE_MAX_ANISOTROPY_EXT     0x84FE
104 #define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
105 #endif
106 extern int ogl_ext_texture_filter_anisotropic_ok;
107
108 extern int gl_initialized;
109 extern int GL_texmagfilt,GL_texminfilt,GL_needmipmaps;
110 extern float GL_texanisofilt;
111 extern int gl_reticle;
112
113 extern int active_texture_unit;
114 void ogl_setActiveTexture(int t);
115
116 int ogl_check_mode(int x, int y); // check if mode is valid
117 int ogl_init_window(int x, int y);//create a window/switch modes/etc
118 void ogl_destroy_window(void);//destroy window/etc
119 void ogl_init(void);//one time initialization
120 void ogl_close(void);//one time shutdown
121
122 void ogl_loadbmtexture_m(grs_bitmap *bm,int domipmap);
123 void ogl_freebmtexture(grs_bitmap *bm);
124
125 void ogl_start_offscreen_render(int x, int y, int w, int h);
126 void ogl_end_offscreen_render(void);
127 void ogl_start_frame(void);
128 void ogl_end_frame(void);
129 void ogl_swap_buffers(void);
130 void ogl_set_screen_mode(void);
131 void ogl_cache_level_textures(void);
132
133 void ogl_urect(int left, int top, int right, int bot);
134 bool ogl_ubitmapm_c(int x, int y, grs_bitmap *bm, int c);
135 bool ogl_ubitmapm(int x, int y, grs_bitmap *bm);
136 bool ogl_ubitblt_i(int dw, int dh, int dx, int dy, int sw, int sh, int sx, int sy, grs_bitmap * src, grs_bitmap * dest);
137 bool ogl_ubitblt(int w, int h, int dx, int dy, int sx, int sy, grs_bitmap * src, grs_bitmap * dest);
138 bool ogl_ubitblt_tolinear(int w, int h, int dx, int dy, int sx, int sy, grs_bitmap * src, grs_bitmap * dest);
139 bool ogl_ubitblt_copy(int w, int h, int dx, int dy, int sx, int sy, grs_bitmap * src, grs_bitmap * dest);
140 void ogl_upixelc(int x, int y, int c);
141 void ogl_ulinec(int left, int top, int right, int bot, int c);
142
143 #include "3d.h"
144 bool g3_draw_tmap_2(int nv,g3s_point **pointlist,g3s_uvl *uvl_list,grs_bitmap *bmbot,grs_bitmap *bm, int orient);
145
146 void ogl_draw_reticle(int cross, int primary, int secondary);
147
148 #endif /* _OGL_INIT_H_ */