2014-03-15 16:59:03 +00:00
|
|
|
// Emacs style mode select -*- C++ -*-
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License
|
|
|
|
// as published by the Free Software Foundation; either version 2
|
|
|
|
// of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
/// \file
|
|
|
|
/// \brief OpenGL API for Doom Legacy
|
|
|
|
|
|
|
|
#ifndef _R_OPENGL_H_
|
|
|
|
#define _R_OPENGL_H_
|
|
|
|
|
2014-07-25 23:10:24 +00:00
|
|
|
#ifdef HAVE_SDL
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
#ifdef _MSC_VER
|
|
|
|
#pragma warning(disable : 4214 4244)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "SDL_opengl.h" //Alam_GBC: Simple, yes?
|
|
|
|
|
|
|
|
#ifdef _MSC_VER
|
|
|
|
#pragma warning(default : 4214 4244)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#else
|
|
|
|
#include <GL/gl.h>
|
|
|
|
#include <GL/glu.h>
|
2014-09-04 00:35:29 +00:00
|
|
|
|
|
|
|
#ifndef MINI_GL_COMPATIBILITY
|
|
|
|
#ifdef STATIC_OPENGL // Because of the 1.3 functions, you'll need GLext to compile it if static
|
|
|
|
#define GL_GLEXT_PROTOTYPES
|
|
|
|
#include <GL/glext.h>
|
|
|
|
#endif
|
|
|
|
#endif
|
2014-03-15 16:59:03 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define _CREATE_DLL_ // necessary for Unix AND Windows
|
|
|
|
#include "../../doomdef.h"
|
|
|
|
#include "../hw_drv.h"
|
|
|
|
|
|
|
|
// ==========================================================================
|
|
|
|
// DEFINITIONS
|
|
|
|
// ==========================================================================
|
|
|
|
|
|
|
|
#define MIN(x,y) (((x)<(y)) ? (x) : (y))
|
|
|
|
#define MAX(x,y) (((x)>(y)) ? (x) : (y))
|
|
|
|
|
|
|
|
#undef DEBUG_TO_FILE // maybe defined in previous *.h
|
|
|
|
#define DEBUG_TO_FILE // output debugging msgs to ogllog.txt
|
2015-01-01 19:50:31 +00:00
|
|
|
|
|
|
|
// todo: find some way of getting SDL to log to ogllog.txt, without
|
|
|
|
// interfering with r_opengl.dll
|
|
|
|
#ifdef HAVE_SDL
|
2014-03-15 16:59:03 +00:00
|
|
|
#undef DEBUG_TO_FILE
|
|
|
|
#endif
|
2015-01-01 19:50:31 +00:00
|
|
|
//#if defined(HAVE_SDL) && !defined(_DEBUG)
|
|
|
|
//#undef DEBUG_TO_FILE
|
|
|
|
//#endif
|
|
|
|
|
|
|
|
#ifdef DEBUG_TO_FILE
|
|
|
|
extern FILE *gllogstream;
|
|
|
|
#endif
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
#ifndef DRIVER_STRING
|
|
|
|
// #define USE_PALETTED_TEXTURE
|
|
|
|
#define DRIVER_STRING "HWRAPI Init(): SRB2 OpenGL renderer" // Tails
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// ==========================================================================
|
|
|
|
// PROTOS
|
|
|
|
// ==========================================================================
|
|
|
|
|
|
|
|
boolean LoadGL(void);
|
|
|
|
void *GetGLFunc(const char *proc);
|
|
|
|
boolean SetupGLfunc(void);
|
2014-09-04 00:35:29 +00:00
|
|
|
boolean SetupGLFunc13(void);
|
2014-03-15 16:59:03 +00:00
|
|
|
void Flush(void);
|
|
|
|
INT32 isExtAvailable(const char *extension, const GLubyte *start);
|
|
|
|
boolean SetupPixelFormat(INT32 WantColorBits, INT32 WantStencilBits, INT32 WantDepthBits);
|
|
|
|
void SetModelView(GLint w, GLint h);
|
|
|
|
void SetStates(void);
|
|
|
|
FUNCMATH float byteasfloat(UINT8 fbyte);
|
|
|
|
#ifdef USE_PALETTED_TEXTURE
|
|
|
|
extern PFNGLCOLORTABLEEXTPROC glColorTableEXT;
|
|
|
|
extern GLubyte palette_tex[256*3];
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef GL_EXT_texture_filter_anisotropic
|
|
|
|
#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
|
|
|
|
#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef USE_WGL_SWAP
|
|
|
|
typedef BOOL (APIENTRY *PFNWGLEXTSWAPCONTROLPROC) (int);
|
|
|
|
typedef int (APIENTRY *PFNWGLEXTGETSWAPINTERVALPROC) (void);
|
|
|
|
extern PFNWGLEXTSWAPCONTROLPROC wglSwapIntervalEXT;
|
|
|
|
extern PFNWGLEXTGETSWAPINTERVALPROC wglGetSwapIntervalEXT;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef STATIC_OPENGL
|
|
|
|
#define pglClear glClear
|
|
|
|
#define pglGetIntegerv glGetIntegerv
|
|
|
|
#define pglGetString glGetString
|
|
|
|
#else
|
|
|
|
/* 1.0 Miscellaneous functions */
|
|
|
|
typedef void (APIENTRY * PFNglClear) (GLbitfield mask);
|
|
|
|
extern PFNglClear pglClear;
|
|
|
|
typedef void (APIENTRY * PFNglGetIntegerv) (GLenum pname, GLint *params);
|
|
|
|
extern PFNglGetIntegerv pglGetIntegerv;
|
|
|
|
typedef const GLubyte* (APIENTRY * PFNglGetString) (GLenum name);
|
|
|
|
extern PFNglGetString pglGetString;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// ==========================================================================
|
|
|
|
// GLOBAL
|
|
|
|
// ==========================================================================
|
|
|
|
|
|
|
|
extern const GLubyte *gl_extensions;
|
|
|
|
extern RGBA_t myPaletteData[];
|
|
|
|
extern GLint screen_width;
|
|
|
|
extern GLint screen_height;
|
|
|
|
extern GLbyte screen_depth;
|
|
|
|
extern GLint maximumAnisotropy;
|
|
|
|
|
|
|
|
/** \brief OpenGL flags for video driver
|
|
|
|
*/
|
|
|
|
extern INT32 oglflags;
|
|
|
|
extern GLint textureformatGL;
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
GLF_NOZBUFREAD = 0x01,
|
|
|
|
GLF_NOTEXENV = 0x02,
|
|
|
|
} oglflags_t;
|
|
|
|
|
|
|
|
#endif
|