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