2003-11-03 17:22:45 +01:00
|
|
|
#ifndef __OGL_H__
|
|
|
|
#define __OGL_H__
|
|
|
|
|
2004-08-06 16:58:58 +02:00
|
|
|
|
|
|
|
// Enable oglCheck(), which breaks into the debugger whenever
|
|
|
|
// an OpenGL call fails. (Then insert dozens of calls to oglCheck()
|
|
|
|
// to locate the cause of the problem.)
|
|
|
|
#if !( defined(NDEBUG) || defined(TESTING) )
|
|
|
|
# define OGL_CHECKS
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2003-11-03 17:22:45 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
2004-06-03 20:38:14 +02:00
|
|
|
#include "sysdep/win/wgl.h"
|
2003-11-03 17:22:45 +01:00
|
|
|
#endif
|
2004-05-06 19:14:30 +02:00
|
|
|
|
|
|
|
|
2004-06-03 20:38:14 +02:00
|
|
|
//
|
|
|
|
// OpenGL header
|
|
|
|
//
|
2003-11-03 17:22:45 +01:00
|
|
|
|
|
|
|
#ifdef __APPLE__
|
2004-05-06 19:14:30 +02:00
|
|
|
# include <OpenGL/gl.h>
|
|
|
|
# include <OpenGL/glu.h>
|
2003-11-03 17:22:45 +01:00
|
|
|
#else
|
2004-05-06 19:14:30 +02:00
|
|
|
# include <GL/gl.h>
|
|
|
|
# include <GL/glu.h>
|
2003-11-03 17:22:45 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// glext
|
|
|
|
//
|
|
|
|
|
|
|
|
// if gl.h provides real prototypes for 1.2 / 1.3 functions,
|
|
|
|
// exclude the corresponding function pointers in glext_funcs.h
|
2003-11-25 03:26:06 +01:00
|
|
|
#ifdef GL_VERSION_1_2
|
|
|
|
#define REAL_GL_1_2
|
2003-11-03 17:22:45 +01:00
|
|
|
#endif
|
|
|
|
#ifdef GL_VERSION_1_3
|
|
|
|
#define REAL_GL_1_3
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#undef GL_GLEXT_PROTOTYPES
|
|
|
|
#ifdef __APPLE__
|
2004-05-06 19:14:30 +02:00
|
|
|
# include <OpenGL/glext.h>
|
2003-11-03 17:22:45 +01:00
|
|
|
#else
|
2004-05-06 19:14:30 +02:00
|
|
|
# include <GL/glext.h>
|
2004-06-09 15:46:39 +02:00
|
|
|
# ifdef _WIN32
|
|
|
|
# include <GL/wglext.h>
|
|
|
|
# endif
|
2003-11-03 17:22:45 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define GL_TEXTURE_IMAGE_SIZE_ARB 0x86A0
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// function pointer declarations
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
2004-05-06 19:14:30 +02:00
|
|
|
# define CALL_CONV __stdcall
|
2003-11-03 17:22:45 +01:00
|
|
|
#else
|
2004-05-06 19:14:30 +02:00
|
|
|
# define CALL_CONV
|
2003-11-03 17:22:45 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define FUNC(ret, name, params) extern ret (CALL_CONV *name) params;
|
|
|
|
#include "glext_funcs.h"
|
|
|
|
#undef FUNC
|
|
|
|
|
|
|
|
// leave CALL_CONV defined for ogl.cpp
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// OpenGL util
|
|
|
|
//
|
|
|
|
|
|
|
|
extern int max_tex_size; // [pixels]
|
|
|
|
extern int tex_units;
|
|
|
|
extern int max_VAR_elements; // GF2: 64K; GF3: 1M
|
|
|
|
extern bool tex_compression_avail; // S3TC / DXT{1,3,5}
|
2005-01-23 18:54:20 +01:00
|
|
|
extern int video_mem; // [MiB]; approximate
|
2003-11-03 17:22:45 +01:00
|
|
|
|
|
|
|
|
|
|
|
// check if the extension <ext> is supported by the OpenGL implementation
|
2005-03-10 17:57:42 +01:00
|
|
|
extern bool oglHaveExtension(const char* ext);
|
|
|
|
|
|
|
|
// check if the OpenGL implementation is at least at <version>.
|
|
|
|
// (format: "%d.%d" major minor)
|
|
|
|
extern bool oglHaveVersion(const char* version);
|
2003-11-03 17:22:45 +01:00
|
|
|
|
|
|
|
// print all OpenGL errors
|
2005-01-23 18:54:20 +01:00
|
|
|
extern void oglPrintErrors(void);
|
2003-11-03 17:22:45 +01:00
|
|
|
|
2004-08-06 16:58:58 +02:00
|
|
|
#ifdef OGL_CHECKS
|
2005-01-23 18:54:20 +01:00
|
|
|
extern void oglCheck(void);
|
2004-08-06 16:58:58 +02:00
|
|
|
#else
|
|
|
|
# define oglCheck()
|
|
|
|
#endif
|
|
|
|
|
2004-05-26 01:16:21 +02:00
|
|
|
// call before using any of the above, and after each mode change.
|
|
|
|
//
|
|
|
|
// fails if OpenGL not ready for use.
|
2005-01-23 18:54:20 +01:00
|
|
|
extern void oglInit(void);
|
2003-11-03 17:22:45 +01:00
|
|
|
|
2004-05-26 01:16:21 +02:00
|
|
|
// set detect.cpp gfx_card[] and gfx_drv_ver[].
|
|
|
|
// (called by detect.cpp get_gfx_info()).
|
|
|
|
//
|
|
|
|
// fails if OpenGL not ready for use.
|
|
|
|
// gfx_card and gfx_drv_ver are unchanged on failure.
|
2005-01-23 18:54:20 +01:00
|
|
|
extern int ogl_get_gfx_info(void);
|
2004-05-26 01:16:21 +02:00
|
|
|
|
2004-07-19 21:04:17 +02:00
|
|
|
// return a NULL-terminated string (of unlimited length) containing
|
|
|
|
// a space-separated list of supported extensions.
|
2005-01-23 18:54:20 +01:00
|
|
|
extern const char* oglExtList(void);
|
2003-11-03 17:22:45 +01:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif // #ifndef __OGL_H__
|