Subversion Repositories Games.Descent

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 pmbaty 1
/*
2
 * This file is part of the DXX-Rebirth project <https://www.dxx-rebirth.com/>.
3
 * It is copyright by its individual contributors, as recorded in the
4
 * project's Git history.  See COPYING.txt at the top level for license
5
 * terms and a link to the Git history.
6
 */
7
/* prototypes for function calls between files within the OpenGL module */
8
 
9
#pragma once
10
 
11
#include "dxxsconf.h"
12
#if DXX_USE_OGL
13
#include "ogl_init.h" // interface to OpenGL module
14
#include "gr.h"
15
 
16
#ifdef __cplusplus
17
 
18
void ogl_init_texture_list_internal(void);
19
void ogl_smash_texture_list_internal(void);
20
 
21
namespace dcx {
22
extern int linedotscale;
23
 
24
extern int GL_TEXTURE_2D_enabled;
25
}
26
 
27
#define OGL_SET_FEATURE_STATE(G,V,F)    static_cast<void>(G != V && (G = V, F, 0))
28
#define OGL_ENABLE(a)   OGL_SET_FEATURE_STATE(GL_##a##_enabled, 1, glEnable(GL_##a))
29
#define OGL_DISABLE(a)  OGL_SET_FEATURE_STATE(GL_##a##_enabled, 0, glDisable(GL_##a))
30
 
31
//#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);)
32
//#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);)
33
//#define OGL_SETSTATE(a,s,f) {if (a ## _state!=s) {f;a ## _state=s;}}
34
//#define OGL_TEXENV(p,m) OGL_SETSTATE(p,m,glTexEnvi(GL_TEXTURE_ENV, p,m));
35
//#define OGL_TEXPARAM(p,m) OGL_SETSTATE(p,m,glTexParameteri(GL_TEXTURE_2D,p,m))
36
 
37
namespace dcx {
38
extern unsigned last_width,last_height;
39
static inline void OGL_VIEWPORT(const unsigned x, const unsigned y, const unsigned w, const unsigned h)
40
{
41
        if (w!=last_width || h!=last_height)
42
        {
43
                last_width = w;
44
                last_height = h;
45
                glViewport(x,grd_curscreen->sc_canvas.cv_bitmap.bm_h-y-h,w,h);
46
        }
47
}
48
 
49
#ifdef dsx
50
//platform specific funcs
51
void ogl_swap_buffers_internal();
52
#endif
53
}
54
 
55
#endif
56
#endif