2013-06-23 07:49:34 +00:00
|
|
|
#ifndef R_RENDER
|
|
|
|
#define R_RENDER
|
|
|
|
|
|
|
|
#if defined(__APPLE__)
|
|
|
|
#define APIENTRY
|
2013-06-28 08:02:55 +00:00
|
|
|
#define APIENTRYP *
|
2013-06-23 07:49:34 +00:00
|
|
|
#endif // __APPLE__
|
|
|
|
|
2013-06-26 23:01:00 +00:00
|
|
|
#include "basictypes.h"
|
|
|
|
#ifndef _WIN32
|
|
|
|
typedef bool BOOL;
|
|
|
|
#endif
|
|
|
|
|
2013-06-23 07:49:34 +00:00
|
|
|
#ifndef PFNGLMULTITEXCOORD2FPROC
|
|
|
|
typedef void (APIENTRYP PFNGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t);
|
|
|
|
#endif
|
|
|
|
#ifndef PFNGLMULTITEXCOORD2FVPROC
|
|
|
|
typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVPROC) (GLenum target, const GLfloat *v);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
enum RenderFlags
|
|
|
|
{
|
|
|
|
RFL_NPOT_TEXTURE=1,
|
|
|
|
RFL_OCCLUSION_QUERY=4,
|
|
|
|
// [BB] Added texture compression flags.
|
|
|
|
RFL_TEXTURE_COMPRESSION=8,
|
|
|
|
RFL_TEXTURE_COMPRESSION_S3TC=16,
|
|
|
|
|
|
|
|
RFL_VBO = 32,
|
|
|
|
RFL_MAP_BUFFER_RANGE = 64,
|
|
|
|
RFL_FRAMEBUFFER = 128,
|
|
|
|
RFL_TEXTUREBUFFER = 256,
|
|
|
|
RFL_NVIDIA = 512,
|
|
|
|
RFL_ATI = 1024,
|
|
|
|
|
|
|
|
|
|
|
|
RFL_GL_20 = 0x10000000,
|
|
|
|
RFL_GL_21 = 0x20000000,
|
|
|
|
RFL_GL_30 = 0x40000000,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum TexMode
|
|
|
|
{
|
|
|
|
TMF_MASKBIT = 1,
|
|
|
|
TMF_OPAQUEBIT = 2,
|
|
|
|
TMF_INVERTBIT = 4,
|
|
|
|
|
|
|
|
TM_MODULATE = 0,
|
|
|
|
TM_MASK = TMF_MASKBIT,
|
|
|
|
TM_OPAQUE = TMF_OPAQUEBIT,
|
|
|
|
TM_INVERT = TMF_INVERTBIT,
|
|
|
|
//TM_INVERTMASK = TMF_MASKBIT | TMF_INVERTBIT
|
|
|
|
TM_INVERTOPAQUE = TMF_INVERTBIT | TMF_OPAQUEBIT,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct RenderContext
|
|
|
|
{
|
|
|
|
unsigned int flags;
|
|
|
|
unsigned int shadermodel;
|
|
|
|
unsigned int maxuniforms;
|
|
|
|
int max_texturesize;
|
|
|
|
char * vendorstring;
|
|
|
|
|
|
|
|
int MaxLights() const
|
|
|
|
{
|
|
|
|
return maxuniforms>=2048? 128:64;
|
|
|
|
}
|
|
|
|
|
|
|
|
void (APIENTRY * BlendEquation) (GLenum);
|
|
|
|
|
|
|
|
// ARB_SHADER_OBJECTS
|
|
|
|
PFNGLDELETESHADERPROC DeleteShader;
|
|
|
|
PFNGLDELETEPROGRAMPROC DeleteProgram;
|
|
|
|
PFNGLDETACHSHADERPROC DetachShader;
|
|
|
|
PFNGLCREATESHADERPROC CreateShader;
|
|
|
|
PFNGLSHADERSOURCEPROC ShaderSource;
|
|
|
|
PFNGLCOMPILESHADERPROC CompileShader;
|
|
|
|
PFNGLCREATEPROGRAMPROC CreateProgram;
|
|
|
|
PFNGLATTACHSHADERPROC AttachShader;
|
|
|
|
PFNGLLINKPROGRAMPROC LinkProgram;
|
|
|
|
PFNGLUSEPROGRAMPROC UseProgram;
|
|
|
|
PFNGLVALIDATEPROGRAMPROC ValidateProgram;
|
|
|
|
PFNGLVERTEXATTRIB1FPROC VertexAttrib1f;
|
|
|
|
PFNGLVERTEXATTRIB2FPROC VertexAttrib2f;
|
|
|
|
PFNGLVERTEXATTRIB4FPROC VertexAttrib4f;
|
|
|
|
PFNGLVERTEXATTRIB2FVPROC VertexAttrib2fv;
|
|
|
|
PFNGLVERTEXATTRIB3FVPROC VertexAttrib3fv;
|
|
|
|
PFNGLVERTEXATTRIB4FVPROC VertexAttrib4fv;
|
|
|
|
PFNGLVERTEXATTRIB4UBVPROC VertexAttrib4ubv;
|
|
|
|
PFNGLGETATTRIBLOCATIONPROC GetAttribLocation;
|
|
|
|
PFNGLBINDATTRIBLOCATIONPROC BindAttribLocation;
|
|
|
|
|
|
|
|
PFNGLUNIFORM1FPROC Uniform1f;
|
|
|
|
PFNGLUNIFORM2FPROC Uniform2f;
|
|
|
|
PFNGLUNIFORM3FPROC Uniform3f;
|
|
|
|
PFNGLUNIFORM4FPROC Uniform4f;
|
|
|
|
PFNGLUNIFORM1IPROC Uniform1i;
|
|
|
|
PFNGLUNIFORM2IPROC Uniform2i;
|
|
|
|
PFNGLUNIFORM3IPROC Uniform3i;
|
|
|
|
PFNGLUNIFORM4IPROC Uniform4i;
|
|
|
|
PFNGLUNIFORM1FVPROC Uniform1fv;
|
|
|
|
PFNGLUNIFORM2FVPROC Uniform2fv;
|
|
|
|
PFNGLUNIFORM3FVPROC Uniform3fv;
|
|
|
|
PFNGLUNIFORM4FVPROC Uniform4fv;
|
|
|
|
PFNGLUNIFORM1IVPROC Uniform1iv;
|
|
|
|
PFNGLUNIFORM2IVPROC Uniform2iv;
|
|
|
|
PFNGLUNIFORM3IVPROC Uniform3iv;
|
|
|
|
PFNGLUNIFORM4IVPROC Uniform4iv;
|
|
|
|
|
|
|
|
PFNGLUNIFORMMATRIX2FVPROC UniformMatrix2fv;
|
|
|
|
PFNGLUNIFORMMATRIX3FVPROC UniformMatrix3fv;
|
|
|
|
PFNGLUNIFORMMATRIX4FVPROC UniformMatrix4fv;
|
|
|
|
|
|
|
|
PFNGLGETSHADERINFOLOGPROC GetShaderInfoLog;
|
|
|
|
PFNGLGETPROGRAMINFOLOGPROC GetProgramInfoLog;
|
|
|
|
PFNGLGETUNIFORMLOCATIONPROC GetUniformLocation;
|
|
|
|
PFNGLGETACTIVEUNIFORMPROC GetActiveUniform;
|
|
|
|
PFNGLGETUNIFORMFVPROC GetUniformfv;
|
|
|
|
PFNGLGETUNIFORMIVPROC GetUniformiv;
|
|
|
|
PFNGLGETSHADERSOURCEPROC GetShaderSource;
|
|
|
|
PFNGLGETOBJECTPARAMETERIVARBPROC GetObjectParameteriv;
|
|
|
|
|
|
|
|
PFNGLGENQUERIESARBPROC GenQueries;
|
|
|
|
PFNGLDELETEQUERIESARBPROC DeleteQueries;
|
|
|
|
PFNGLBEGINQUERYARBPROC BeginQuery;
|
|
|
|
PFNGLENDQUERYARBPROC EndQuery;
|
|
|
|
PFNGLGETQUERYOBJECTUIVARBPROC GetQueryObjectuiv;
|
|
|
|
|
|
|
|
PFNGLACTIVETEXTUREPROC ActiveTexture;
|
|
|
|
PFNGLMULTITEXCOORD2FPROC MultiTexCoord2f;
|
|
|
|
PFNGLMULTITEXCOORD2FVPROC MultiTexCoord2fv;
|
|
|
|
|
|
|
|
PFNGLBINDBUFFERPROC BindBuffer;
|
|
|
|
PFNGLDELETEBUFFERSPROC DeleteBuffers;
|
|
|
|
PFNGLGENBUFFERSPROC GenBuffers;
|
|
|
|
PFNGLBUFFERDATAPROC BufferData;
|
|
|
|
PFNGLBUFFERSUBDATAPROC BufferSubData;
|
|
|
|
PFNGLMAPBUFFERPROC MapBuffer;
|
|
|
|
PFNGLUNMAPBUFFERPROC UnmapBuffer;
|
|
|
|
PFNGLENABLEVERTEXATTRIBARRAYPROC EnableVertexAttribArray;
|
|
|
|
PFNGLDISABLEVERTEXATTRIBARRAYPROC DisableVertexAttribArray;
|
|
|
|
PFNGLVERTEXATTRIBPOINTERPROC VertexAttribPointer;
|
|
|
|
|
|
|
|
PFNGLMAPBUFFERRANGEPROC MapBufferRange;
|
|
|
|
PFNGLFLUSHMAPPEDBUFFERRANGEPROC FlushMappedBufferRange;
|
|
|
|
|
|
|
|
PFNGLGENFRAMEBUFFERSPROC GenFramebuffers;
|
|
|
|
PFNGLDELETEFRAMEBUFFERSPROC DeleteFramebuffers;
|
|
|
|
PFNGLBINDFRAMEBUFFERPROC BindFramebuffer;
|
|
|
|
PFNGLFRAMEBUFFERTEXTURE2DPROC FramebufferTexture2D;
|
|
|
|
PFNGLGENRENDERBUFFERSPROC GenRenderbuffers;
|
|
|
|
PFNGLDELETERENDERBUFFERSPROC DeleteRenderbuffers;
|
|
|
|
PFNGLBINDRENDERBUFFERPROC BindRenderbuffer;
|
|
|
|
PFNGLRENDERBUFFERSTORAGEPROC RenderbufferStorage;
|
|
|
|
PFNGLFRAMEBUFFERRENDERBUFFERPROC FramebufferRenderbuffer;
|
|
|
|
|
|
|
|
PFNGLTEXBUFFERARBPROC TexBufferARB;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|