]> icculus.org git repositories - btb/d2x.git/blob - arch/ogl/internal.h
use the orientation parameter of g3_draw_bitmap
[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 unsigned last_width,last_height;
56
57 static inline void OGL_VIEWPORT(const unsigned x, const unsigned y, const unsigned w, const unsigned h)
58 {
59         if (w != last_width || h != last_height)
60         {
61                 glViewport(x, grd_curscreen->sc_canvas.cv_bitmap.bm_h - y - h, w, h);
62                 last_width = w;
63                 last_height = h;
64         }
65 }
66
67
68 //platform specific funcs
69 void ogl_swap_buffers_internal(void);
70
71 extern unsigned char *ogl_pal;
72
73 //whee
74 //#define PAL2Tr(c) ((gr_palette[c*3]+gr_palette_gamma.intval)/63.0)
75 //#define PAL2Tg(c) ((gr_palette[c*3+1]+gr_palette_gamma.intval)/63.0)
76 //#define PAL2Tb(c) ((gr_palette[c*3+2]+gr_palette_gamma.intval)/63.0)
77 //#define PAL2Tr(c) ((gr_palette[c*3])/63.0)
78 //#define PAL2Tg(c) ((gr_palette[c*3+1])/63.0)
79 //#define PAL2Tb(c) ((gr_palette[c*3+2])/63.0)
80 #define CPAL2Tr(c) ((gr_current_pal[c*3])/63.0)
81 #define CPAL2Tg(c) ((gr_current_pal[c*3+1])/63.0)
82 #define CPAL2Tb(c) ((gr_current_pal[c*3+2])/63.0)
83 #define PAL2Tr(c) ((ogl_pal[c*3])/63.0)
84 #define PAL2Tg(c) ((ogl_pal[c*3+1])/63.0)
85 #define PAL2Tb(c) ((ogl_pal[c*3+2])/63.0)
86 //inline GLfloat PAL2Tr(int c);
87 //inline GLfloat PAL2Tg(int c);
88 //inline GLfloat PAL2Tb(int c);
89
90 #endif // _INTERNAL_H_