]> icculus.org git repositories - btb/d2x.git/blob - arch/ogl/internal.h
made opengl use 32bpp screen mode by default, add option to use 16bpp (d1x r1.4,...
[btb/d2x.git] / arch / ogl / internal.h
1 /* prototypes for function calls between files within the OpenGL module */
2
3 #ifndef _INTERNAL_H_
4 #define _INTERNAL_H_
5
6 #include "ogl_init.h" // interface to OpenGL module
7
8 /* I assume this ought to be >= MAX_BITMAP_FILES in piggy.h? */
9 #define OGL_TEXTURE_LIST_SIZE 3000
10
11 extern ogl_texture ogl_texture_list[OGL_TEXTURE_LIST_SIZE];
12
13 extern int ogl_mem_target;
14
15 void ogl_init_texture_list_internal(void);
16 void ogl_smash_texture_list_internal(void);
17 void ogl_vivify_texture_list_internal(void);
18
19 extern int ogl_brightness_ok;
20 extern int ogl_brightness_r, ogl_brightness_g, ogl_brightness_b;
21 int ogl_setbrightness_internal(void);
22 extern int ogl_fullscreen;
23 void ogl_do_fullscreen_internal(void);
24
25 extern int ogl_voodoohack;
26
27 #ifdef GL_ARB_multitexture
28 extern int ogl_arb_multitexture_ok;
29 #else
30 #define ogl_arb_multitexture_ok 0
31 #endif
32 #ifdef GL_SGIS_multitexture
33 extern int ogl_sgis_multitexture_ok;
34 #else
35 #define ogl_sgis_multitexture_ok 0
36 #endif
37
38 extern int GL_TEXTURE_2D_enabled;
39 //extern int GL_texclamp_enabled;
40 //extern int GL_TEXTURE_ENV_MODE_state,GL_TEXTURE_MAG_FILTER_state,GL_TEXTURE_MIN_FILTER_state;
41 #define OGL_ENABLE2(a,f) {if (a ## _enabled!=1) {f;a ## _enabled=1;}}
42 #define OGL_DISABLE2(a,f) {if (a ## _enabled!=0) {f;a ## _enabled=0;}}
43
44 //#define OGL_ENABLE(a) OGL_ENABLE2(a,glEnable(a))
45 //#define OGL_DISABLE(a) OGL_DISABLE2(a,glDisable(a))
46 #define OGL_ENABLE(a) OGL_ENABLE2(GL_ ## a,glEnable(GL_ ## a))
47 #define OGL_DISABLE(a) OGL_DISABLE2(GL_ ## a,glDisable(GL_ ## a))
48
49 //#define OGL_TEXCLAMP() OGL_ENABLE2(GL_texclamp,glTexParameteri(GL_TEXTURE_2D,  GL_TEXTURE_WRAP_S, GL_CLAMP);glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,    GL_CLAMP);)
50 //#define OGL_TEXREPEAT() OGL_DISABLE2(GL_texclamp,glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);)
51 //#define OGL_SETSTATE(a,s,f) {if (a ## _state!=s) {f;a ## _state=s;}}
52 //#define OGL_TEXENV(p,m) OGL_SETSTATE(p,m,glTexEnvi(GL_TEXTURE_ENV, p,m));
53 //#define OGL_TEXPARAM(p,m) OGL_SETSTATE(p,m,glTexParameteri(GL_TEXTURE_2D,p,m))
54
55 extern int last_width,last_height;
56 #define OGL_VIEWPORT(x,y,w,h){if (w!=last_width || h!=last_height){glViewport(x,grd_curscreen->sc_canvas.cv_bitmap.bm_h-y-h,w,h);last_width=w;last_height=h;}}
57
58 //platform specific funcs
59 //MSVC seems to have problems with inline funcs not being found during linking
60 #ifndef _MSC_VER
61 inline
62 #endif
63 void ogl_swap_buffers_internal(void);
64
65 extern unsigned char *ogl_pal;
66
67 //whee
68 //#define PAL2Tr(c) ((gr_palette[c*3]+gr_palette_gamma)/63.0)
69 //#define PAL2Tg(c) ((gr_palette[c*3+1]+gr_palette_gamma)/63.0)
70 //#define PAL2Tb(c) ((gr_palette[c*3+2]+gr_palette_gamma)/63.0)
71 //#define PAL2Tr(c) ((gr_palette[c*3])/63.0)
72 //#define PAL2Tg(c) ((gr_palette[c*3+1])/63.0)
73 //#define PAL2Tb(c) ((gr_palette[c*3+2])/63.0)
74 #define CPAL2Tr(c) ((gr_current_pal[c*3])/63.0)
75 #define CPAL2Tg(c) ((gr_current_pal[c*3+1])/63.0)
76 #define CPAL2Tb(c) ((gr_current_pal[c*3+2])/63.0)
77 #define PAL2Tr(c) ((ogl_pal[c*3])/63.0)
78 #define PAL2Tg(c) ((ogl_pal[c*3+1])/63.0)
79 #define PAL2Tb(c) ((ogl_pal[c*3+2])/63.0)
80 //inline GLfloat PAL2Tr(int c);
81 //inline GLfloat PAL2Tg(int c);
82 //inline GLfloat PAL2Tb(int c);
83
84 #endif // _INTERNAL_H_