📄 video.h
字号:
#ifndef VIDEO_H
#define VIDEO_H
#include "util.h"
#ifdef _WIN32
#include "wglext.h" //WGL extensions
#include "glext.h" //GL extensions
// non-vbo
extern PFNGLDRAWRANGEELEMENTSPROC glDrawRangeElements;
#else // Linux
//#include <GL/glext.h> #include <stdarg.h> #include <GL/glext.h> #include <GL/glx.h> // VBO Extension Definitions, From glext.h
#define GL_ARRAY_BUFFER_ARB 0x8892
#define GL_STATIC_DRAW_ARB 0x88E4 #define GL_STREAM_DRAW_ARB 0x88E0 #define GL_WRITE_ONLY 0x88B9 #define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 #define GL_COMPRESSED_RGB_S3TC_DXT3_EXT 0x83F2 // Texture Compression typedef void (APIENTRY * PFNGLCOMPRESSEDTEXIMAGE2DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); // Multi Textures typedef void (APIENTRY * PFNGLACTIVETEXTUREARBPROC) (GLenum texture); typedef void (APIENTRY * PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture); typedef void (APIENTRY * PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t); // Draw Range Elements //typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); // VBO extensions typedef void (APIENTRY * PFNGLBINDBUFFERARBPROC) (GLenum target, GLuint buffer);
typedef void (APIENTRY * PFNGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint *buffers);
typedef void (APIENTRY * PFNGLGENBUFFERSARBPROC) (GLsizei n, GLuint *buffers);
typedef void (APIENTRY * PFNGLBUFFERDATAARBPROC) (GLenum target, int size, const GLvoid *data, GLenum usage); //Map/unmap buffer typedef GLvoid* (APIENTRY * PFNGLMAPBUFFERARBPROC) (GLenum target, GLenum access);
typedef GLboolean (APIENTRY * PFNGLUNMAPBUFFERARBPROC) (GLenum target);
#endif
// multi textures
extern PFNGLMULTITEXCOORD2FARBPROC glMultiTexCoord2fARB;
extern PFNGLACTIVETEXTUREARBPROC glActiveTextureARB;
extern PFNGLCLIENTACTIVETEXTUREARBPROC glClientActiveTextureARB;
// compressed textures
extern PFNGLCOMPRESSEDTEXIMAGE2DARBPROC glCompressedTexImage2DARB;
// VBO
extern PFNGLGENBUFFERSARBPROC glGenBuffersARB;
extern PFNGLBINDBUFFERARBPROC glBindBufferARB;
extern PFNGLBUFFERDATAARBPROC glBufferDataARB;
extern PFNGLDELETEBUFFERSARBPROC glDeleteBuffersARB;
extern PFNGLMAPBUFFERARBPROC glMapBufferARB;
extern PFNGLUNMAPBUFFERARBPROC glUnmapBufferARB;
#include "vec3d.h"
#include "manager.h"
#include "mpq.h"
#include "ddslib.h"
using namespace std;
#ifndef PI
#define PI 3.14159265358f
#endif
#define GL_BUFFER_OFFSET(i) ((char *)(0) + (i))
typedef GLuint TextureID;
class Texture : public ManagedItem {
public:
int w,h;
GLuint id;
bool compressed;
Texture(std::string name):ManagedItem(name), w(0), h(0), id(0), compressed(false) {}
void getPixels(unsigned char *buf);
};
class TextureManager : public Manager<GLuint> {
public:
virtual GLuint add(std::string name);
void doDelete(GLuint id);
void LoadBLP(GLuint id, Texture *tex);
};
void getTextureData(GLuint tex, unsigned char *buf);
extern bool supportCompression;
extern bool supportMultiTex;
extern bool supportVBO;
extern bool supportDrawRangeElements;
//extern bool supportAntiAlias;
//extern int arbMultisampleFormat;
//extern bool InitMultisample(HDC hDC);
extern TextureManager texturemanager;
extern int gXres, gYres;
void InitExtensions();
void decompressDXTC(GLint format, int w, int h, size_t size, unsigned char *src, unsigned char *dest);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -