]> icculus.org git repositories - btb/d2x.git/blob - arch/ogl/internal.h
add ogl_setbrightness_internal stub for glx (d1x r1.17)
[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(ogl_texture* t);
16 void ogl_init_texture_list_internal(void);
17 void ogl_smash_texture_list_internal(void);
18 void ogl_vivify_texture_list_internal(void);
19
20 extern int ogl_brightness_ok;
21 extern int ogl_brightness_r, ogl_brightness_g, ogl_brightness_b;
22 int ogl_setbrightness_internal(void);
23 extern int ogl_fullscreen;
24 void ogl_do_fullscreen_internal(void);
25
26 extern int ogl_voodoohack;
27
28 #ifdef GL_ARB_multitexture
29 extern int ogl_arb_multitexture_ok;
30 #else
31 #define ogl_arb_multitexture_ok 0
32 #endif
33 #ifdef GL_SGIS_multitexture
34 extern int ogl_sgis_multitexture_ok;
35 #else
36 #define ogl_sgis_multitexture_ok 0
37 #endif
38
39 extern int GL_TEXTURE_2D_enabled;
40 //extern int GL_texclamp_enabled;
41 //extern int GL_TEXTURE_ENV_MODE_state,GL_TEXTURE_MAG_FILTER_state,GL_TEXTURE_MIN_FILTER_state;
42 #define OGL_ENABLE2(a,f) {if (a ## _enabled!=1) {f;a ## _enabled=1;}}
43 #define OGL_DISABLE2(a,f) {if (a ## _enabled!=0) {f;a ## _enabled=0;}}
44
45 //#define OGL_ENABLE(a) OGL_ENABLE2(a,glEnable(a))
46 //#define OGL_DISABLE(a) OGL_DISABLE2(a,glDisable(a))
47 #define OGL_ENABLE(a) OGL_ENABLE2(GL_ ## a,glEnable(GL_ ## a))
48 #define OGL_DISABLE(a) OGL_DISABLE2(GL_ ## a,glDisable(GL_ ## a))
49
50 //#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);)
51 //#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);)
52 //#define OGL_SETSTATE(a,s,f) {if (a ## _state!=s) {f;a ## _state=s;}}
53 //#define OGL_TEXENV(p,m) OGL_SETSTATE(p,m,glTexEnvi(GL_TEXTURE_ENV, p,m));
54 //#define OGL_TEXPARAM(p,m) OGL_SETSTATE(p,m,glTexParameteri(GL_TEXTURE_2D,p,m))
55
56 extern int last_width,last_height;
57 #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;}}
58
59 //platform specific funcs
60 //MSVC seems to have problems with inline funcs not being found during linking
61 #ifndef _MSC_VER
62 inline
63 #endif
64 void ogl_swap_buffers_internal(void);
65
66 extern unsigned char *ogl_pal;
67
68 //whee
69 //#define PAL2Tr(c) ((gr_palette[c*3]+gr_palette_gamma)/63.0)
70 //#define PAL2Tg(c) ((gr_palette[c*3+1]+gr_palette_gamma)/63.0)
71 //#define PAL2Tb(c) ((gr_palette[c*3+2]+gr_palette_gamma)/63.0)
72 //#define PAL2Tr(c) ((gr_palette[c*3])/63.0)
73 //#define PAL2Tg(c) ((gr_palette[c*3+1])/63.0)
74 //#define PAL2Tb(c) ((gr_palette[c*3+2])/63.0)
75 #define CPAL2Tr(c) ((gr_current_pal[c*3])/63.0)
76 #define CPAL2Tg(c) ((gr_current_pal[c*3+1])/63.0)
77 #define CPAL2Tb(c) ((gr_current_pal[c*3+2])/63.0)
78 #define PAL2Tr(c) ((ogl_pal[c*3])/63.0)
79 #define PAL2Tg(c) ((ogl_pal[c*3+1])/63.0)
80 #define PAL2Tb(c) ((ogl_pal[c*3+2])/63.0)
81 //inline GLfloat PAL2Tr(int c);
82 //inline GLfloat PAL2Tg(int c);
83 //inline GLfloat PAL2Tb(int c);
84
85 #endif // _INTERNAL_H_