mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-12-02 00:11:59 +00:00
- moved GLEXT API out of RenderContext struct.
This commit is contained in:
parent
26943fe3fd
commit
2885056f46
35 changed files with 379 additions and 348 deletions
|
@ -3601,6 +3601,14 @@
|
|||
<Filter
|
||||
Name="System"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\gl\api\gl_api.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\gl\api\gl_api.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\gl\system\gl_cvars.h"
|
||||
>
|
||||
|
|
|
@ -886,6 +886,7 @@ add_executable( zdoom WIN32
|
|||
menu/playermenu.cpp
|
||||
menu/readthis.cpp
|
||||
menu/videomenu.cpp
|
||||
gl/api/gl_api.cpp
|
||||
gl/data/gl_sections.cpp
|
||||
gl/data/gl_data.cpp
|
||||
gl/data/gl_portaldata.cpp
|
||||
|
|
4
src/gl/api/gl_api.cpp
Normal file
4
src/gl/api/gl_api.cpp
Normal file
|
@ -0,0 +1,4 @@
|
|||
#include "gl/system/gl_system.h"
|
||||
|
||||
#define __EXTERN
|
||||
#include "gl_api.h"
|
100
src/gl/api/gl_api.h
Normal file
100
src/gl/api/gl_api.h
Normal file
|
@ -0,0 +1,100 @@
|
|||
#if defined(__APPLE__)
|
||||
#define APIENTRY
|
||||
#define APIENTRYP *
|
||||
#endif // __APPLE__
|
||||
|
||||
#ifndef __EXTERN
|
||||
#define __EXTERN extern
|
||||
#endif
|
||||
|
||||
__EXTERN PFNGLBLENDEQUATIONPROC glBlendEquation;
|
||||
|
||||
// ARB_SHADER_OBJECTS
|
||||
__EXTERN PFNGLDELETESHADERPROC glDeleteShader;
|
||||
__EXTERN PFNGLDELETEPROGRAMPROC glDeleteProgram;
|
||||
__EXTERN PFNGLDETACHSHADERPROC glDetachShader;
|
||||
__EXTERN PFNGLCREATESHADERPROC glCreateShader;
|
||||
__EXTERN PFNGLSHADERSOURCEPROC glShaderSource;
|
||||
__EXTERN PFNGLCOMPILESHADERPROC glCompileShader;
|
||||
__EXTERN PFNGLCREATEPROGRAMPROC glCreateProgram;
|
||||
__EXTERN PFNGLATTACHSHADERPROC glAttachShader;
|
||||
__EXTERN PFNGLLINKPROGRAMPROC glLinkProgram;
|
||||
__EXTERN PFNGLUSEPROGRAMPROC glUseProgram;
|
||||
__EXTERN PFNGLVALIDATEPROGRAMPROC glValidateProgram;
|
||||
__EXTERN PFNGLVERTEXATTRIB1FPROC glVertexAttrib1f;
|
||||
__EXTERN PFNGLVERTEXATTRIB2FPROC glVertexAttrib2f;
|
||||
__EXTERN PFNGLVERTEXATTRIB4FPROC glVertexAttrib4f;
|
||||
__EXTERN PFNGLVERTEXATTRIB2FVPROC glVertexAttrib2fv;
|
||||
__EXTERN PFNGLVERTEXATTRIB3FVPROC glVertexAttrib3fv;
|
||||
__EXTERN PFNGLVERTEXATTRIB4FVPROC glVertexAttrib4fv;
|
||||
__EXTERN PFNGLVERTEXATTRIB4UBVPROC glVertexAttrib4ubv;
|
||||
__EXTERN PFNGLGETATTRIBLOCATIONPROC glGetAttribLocation;
|
||||
__EXTERN PFNGLBINDATTRIBLOCATIONPROC glBindAttribLocation;
|
||||
|
||||
__EXTERN PFNGLUNIFORM1FPROC glUniform1f;
|
||||
__EXTERN PFNGLUNIFORM2FPROC glUniform2f;
|
||||
__EXTERN PFNGLUNIFORM3FPROC glUniform3f;
|
||||
__EXTERN PFNGLUNIFORM4FPROC glUniform4f;
|
||||
__EXTERN PFNGLUNIFORM1IPROC glUniform1i;
|
||||
__EXTERN PFNGLUNIFORM2IPROC glUniform2i;
|
||||
__EXTERN PFNGLUNIFORM3IPROC glUniform3i;
|
||||
__EXTERN PFNGLUNIFORM4IPROC glUniform4i;
|
||||
__EXTERN PFNGLUNIFORM1FVPROC glUniform1fv;
|
||||
__EXTERN PFNGLUNIFORM2FVPROC glUniform2fv;
|
||||
__EXTERN PFNGLUNIFORM3FVPROC glUniform3fv;
|
||||
__EXTERN PFNGLUNIFORM4FVPROC glUniform4fv;
|
||||
__EXTERN PFNGLUNIFORM1IVPROC glUniform1iv;
|
||||
__EXTERN PFNGLUNIFORM2IVPROC glUniform2iv;
|
||||
__EXTERN PFNGLUNIFORM3IVPROC glUniform3iv;
|
||||
__EXTERN PFNGLUNIFORM4IVPROC glUniform4iv;
|
||||
|
||||
__EXTERN PFNGLUNIFORMMATRIX2FVPROC glUniformMatrix2fv;
|
||||
__EXTERN PFNGLUNIFORMMATRIX3FVPROC glUniformMatrix3fv;
|
||||
__EXTERN PFNGLUNIFORMMATRIX4FVPROC glUniformMatrix4fv;
|
||||
|
||||
__EXTERN PFNGLGETSHADERINFOLOGPROC glGetShaderInfoLog;
|
||||
__EXTERN PFNGLGETPROGRAMINFOLOGPROC glGetProgramInfoLog;
|
||||
__EXTERN PFNGLGETUNIFORMLOCATIONPROC glGetUniformLocation;
|
||||
__EXTERN PFNGLGETACTIVEUNIFORMPROC glGetActiveUniform;
|
||||
__EXTERN PFNGLGETUNIFORMFVPROC glGetUniformfv;
|
||||
__EXTERN PFNGLGETUNIFORMIVPROC glGetUniformiv;
|
||||
__EXTERN PFNGLGETSHADERSOURCEPROC glGetShaderSource;
|
||||
__EXTERN PFNGLGETOBJECTPARAMETERIVARBPROC glGetObjectParameteriv;
|
||||
|
||||
__EXTERN PFNGLGENQUERIESARBPROC glGenQueries;
|
||||
__EXTERN PFNGLDELETEQUERIESARBPROC glDeleteQueries;
|
||||
__EXTERN PFNGLBEGINQUERYARBPROC glBeginQuery;
|
||||
__EXTERN PFNGLENDQUERYARBPROC glEndQuery;
|
||||
__EXTERN PFNGLGETQUERYOBJECTUIVARBPROC glGetQueryObjectuiv;
|
||||
|
||||
__EXTERN PFNGLACTIVETEXTUREPROC glActiveTexture;
|
||||
__EXTERN PFNGLMULTITEXCOORD2FPROC glMultiTexCoord2f;
|
||||
__EXTERN PFNGLMULTITEXCOORD2FVPROC glMultiTexCoord2fv;
|
||||
|
||||
__EXTERN PFNGLBINDBUFFERPROC glBindBuffer;
|
||||
__EXTERN PFNGLDELETEBUFFERSPROC glDeleteBuffers;
|
||||
__EXTERN PFNGLGENBUFFERSPROC glGenBuffers;
|
||||
__EXTERN PFNGLBUFFERDATAPROC glBufferData;
|
||||
__EXTERN PFNGLBUFFERSUBDATAPROC glBufferSubData;
|
||||
__EXTERN PFNGLMAPBUFFERPROC glMapBuffer;
|
||||
__EXTERN PFNGLUNMAPBUFFERPROC glUnmapBuffer;
|
||||
__EXTERN PFNGLENABLEVERTEXATTRIBARRAYPROC glEnableVertexAttribArray;
|
||||
__EXTERN PFNGLDISABLEVERTEXATTRIBARRAYPROC glDisableVertexAttribArray;
|
||||
__EXTERN PFNGLVERTEXATTRIBPOINTERPROC glVertexAttribPointer;
|
||||
|
||||
__EXTERN PFNGLMAPBUFFERRANGEPROC glMapBufferRange;
|
||||
__EXTERN PFNGLFLUSHMAPPEDBUFFERRANGEPROC glFlushMappedBufferRange;
|
||||
|
||||
__EXTERN PFNGLGENFRAMEBUFFERSPROC glGenFramebuffers;
|
||||
__EXTERN PFNGLDELETEFRAMEBUFFERSPROC glDeleteFramebuffers;
|
||||
__EXTERN PFNGLBINDFRAMEBUFFERPROC glBindFramebuffer;
|
||||
__EXTERN PFNGLFRAMEBUFFERTEXTURE2DPROC glFramebufferTexture2D;
|
||||
__EXTERN PFNGLGENRENDERBUFFERSPROC glGenRenderbuffers;
|
||||
__EXTERN PFNGLDELETERENDERBUFFERSPROC glDeleteRenderbuffers;
|
||||
__EXTERN PFNGLBINDRENDERBUFFERPROC glBindRenderbuffer;
|
||||
__EXTERN PFNGLRENDERBUFFERSTORAGEPROC glRenderbufferStorage;
|
||||
__EXTERN PFNGLFRAMEBUFFERRENDERBUFFERPROC glFramebufferRenderbuffer;
|
||||
|
||||
__EXTERN PFNGLTEXBUFFERARBPROC glTexBufferARB;
|
||||
|
||||
#undef __EXTERN
|
|
@ -52,6 +52,7 @@
|
|||
#include "gi.h"
|
||||
#include "g_level.h"
|
||||
|
||||
#include "gl/system/gl_interface.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/renderer/gl_lightdata.h"
|
||||
#include "gl/data/gl_data.h"
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include "p_local.h"
|
||||
#include "m_argv.h"
|
||||
#include "c_cvars.h"
|
||||
#include "gl/system/gl_interface.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/data/gl_data.h"
|
||||
#include "gl/data/gl_vertexbuffer.h"
|
||||
|
@ -77,7 +78,7 @@ FVertexBuffer::FVertexBuffer()
|
|||
if (gl.flags&RFL_VBO)
|
||||
{
|
||||
if (gl_usevbo == -1) gl_usevbo.Callback();
|
||||
gl.GenBuffers(1, &vbo_id);
|
||||
glGenBuffers(1, &vbo_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -85,7 +86,7 @@ FVertexBuffer::~FVertexBuffer()
|
|||
{
|
||||
if (vbo_id != 0)
|
||||
{
|
||||
gl.DeleteBuffers(1, &vbo_id);
|
||||
glDeleteBuffers(1, &vbo_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -273,8 +274,8 @@ void FFlatVertexBuffer::MapVBO()
|
|||
{
|
||||
if (map == NULL)
|
||||
{
|
||||
gl.BindBuffer(GL_ARRAY_BUFFER, vbo_id);
|
||||
map = (FFlatVertex*)gl.MapBufferRange(GL_ARRAY_BUFFER, 0, vbo_shadowdata.Size() * sizeof(FFlatVertex),
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbo_id);
|
||||
map = (FFlatVertex*)glMapBufferRange(GL_ARRAY_BUFFER, 0, vbo_shadowdata.Size() * sizeof(FFlatVertex),
|
||||
GL_MAP_WRITE_BIT|GL_MAP_FLUSH_EXPLICIT_BIT|GL_MAP_UNSYNCHRONIZED_BIT);
|
||||
}
|
||||
}
|
||||
|
@ -289,7 +290,7 @@ void FFlatVertexBuffer::UnmapVBO()
|
|||
{
|
||||
if (map != NULL)
|
||||
{
|
||||
gl.UnmapBuffer(GL_ARRAY_BUFFER);
|
||||
glUnmapBuffer(GL_ARRAY_BUFFER);
|
||||
map = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -316,11 +317,11 @@ void FFlatVertexBuffer::UpdatePlaneVertices(sector_t *sec, int plane)
|
|||
MapVBO();
|
||||
if (map == NULL) return; // Error
|
||||
memcpy(&map[startvt], &vbo_shadowdata[startvt], countvt * sizeof(FFlatVertex));
|
||||
gl.FlushMappedBufferRange(GL_ARRAY_BUFFER, startvt * sizeof(FFlatVertex), countvt * sizeof(FFlatVertex));
|
||||
glFlushMappedBufferRange(GL_ARRAY_BUFFER, startvt * sizeof(FFlatVertex), countvt * sizeof(FFlatVertex));
|
||||
}
|
||||
else
|
||||
{
|
||||
gl.BufferSubData(GL_ARRAY_BUFFER, startvt * sizeof(FFlatVertex), countvt * sizeof(FFlatVertex), &vbo_shadowdata[startvt]);
|
||||
glBufferSubData(GL_ARRAY_BUFFER, startvt * sizeof(FFlatVertex), countvt * sizeof(FFlatVertex), &vbo_shadowdata[startvt]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -336,8 +337,8 @@ void FFlatVertexBuffer::CreateVBO()
|
|||
if (vbo_arg > 0)
|
||||
{
|
||||
CreateFlatVBO();
|
||||
gl.BindBuffer(GL_ARRAY_BUFFER, vbo_id);
|
||||
gl.BufferData(GL_ARRAY_BUFFER, vbo_shadowdata.Size() * sizeof(FFlatVertex), &vbo_shadowdata[0], GL_DYNAMIC_DRAW);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbo_id);
|
||||
glBufferData(GL_ARRAY_BUFFER, vbo_shadowdata.Size() * sizeof(FFlatVertex), &vbo_shadowdata[0], GL_DYNAMIC_DRAW);
|
||||
}
|
||||
else if (sectors)
|
||||
{
|
||||
|
@ -362,8 +363,8 @@ void FFlatVertexBuffer::BindVBO()
|
|||
if (vbo_arg > 0)
|
||||
{
|
||||
UnmapVBO();
|
||||
gl.BindBuffer(GL_ARRAY_BUFFER, vbo_id);
|
||||
gl.BindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbo_id);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
glVertexPointer(3,GL_FLOAT, sizeof(FFlatVertex), &VTO->x);
|
||||
glTexCoordPointer(2,GL_FLOAT, sizeof(FFlatVertex), &VTO->u);
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include "gl/gl_functions.h"
|
||||
#include "g_level.h"
|
||||
|
||||
#include "gl/system/gl_interface.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/renderer/gl_lightdata.h"
|
||||
#include "gl/data/gl_data.h"
|
||||
|
|
|
@ -66,11 +66,11 @@
|
|||
|
||||
FLightBuffer::FLightBuffer()
|
||||
{
|
||||
gl.GenBuffers(1, &mIDbuf_RGB);
|
||||
gl.BindBuffer(GL_TEXTURE_BUFFER, mIDbuf_RGB);
|
||||
glGenBuffers(1, &mIDbuf_RGB);
|
||||
glBindBuffer(GL_TEXTURE_BUFFER, mIDbuf_RGB);
|
||||
|
||||
gl.GenBuffers(1, &mIDbuf_Position);
|
||||
gl.BindBuffer(GL_TEXTURE_BUFFER, mIDbuf_Position);
|
||||
glGenBuffers(1, &mIDbuf_Position);
|
||||
glBindBuffer(GL_TEXTURE_BUFFER, mIDbuf_Position);
|
||||
|
||||
glGenTextures(1, &mIDtex_RGB);
|
||||
glBindTexture(GL_TEXTURE_BUFFER, mIDtex_RGB);
|
||||
|
@ -90,9 +90,9 @@ FLightBuffer::FLightBuffer()
|
|||
|
||||
FLightBuffer::~FLightBuffer()
|
||||
{
|
||||
gl.BindBuffer(GL_TEXTURE_BUFFER, 0);
|
||||
gl.DeleteBuffers(1, &mIDbuf_RGB);
|
||||
gl.DeleteBuffers(1, &mIDbuf_Position);
|
||||
glBindBuffer(GL_TEXTURE_BUFFER, 0);
|
||||
glDeleteBuffers(1, &mIDbuf_RGB);
|
||||
glDeleteBuffers(1, &mIDbuf_Position);
|
||||
|
||||
glBindTexture(GL_TEXTURE_BUFFER, 0);
|
||||
glDeleteTextures(1, &mIDtex_RGB);
|
||||
|
@ -108,11 +108,11 @@ FLightBuffer::~FLightBuffer()
|
|||
|
||||
void FLightBuffer::BindTextures(int texunit1, int texunit2)
|
||||
{
|
||||
gl.ActiveTexture(texunit1);
|
||||
glActiveTexture(texunit1);
|
||||
glBindTexture(GL_TEXTURE_BUFFER, mIDtex_RGB);
|
||||
gl.ActiveTexture(texunit2);
|
||||
glActiveTexture(texunit2);
|
||||
glBindTexture(GL_TEXTURE_BUFFER, mIDtex_Position);
|
||||
gl.ActiveTexture(GL_TEXTURE0);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -155,11 +155,11 @@ void FLightBuffer::CollectLightSources()
|
|||
}
|
||||
GLRenderer->mLightCount = pPos.Size();
|
||||
|
||||
gl.BindBuffer(GL_TEXTURE_BUFFER, mIDbuf_RGB);
|
||||
gl.BufferData(GL_TEXTURE_BUFFER, pLights.Size() * sizeof (FLightRGB), &pLights[0], GL_STREAM_DRAW);
|
||||
glBindBuffer(GL_TEXTURE_BUFFER, mIDbuf_RGB);
|
||||
glBufferData(GL_TEXTURE_BUFFER, pLights.Size() * sizeof (FLightRGB), &pLights[0], GL_STREAM_DRAW);
|
||||
|
||||
gl.BindBuffer(GL_TEXTURE_BUFFER, mIDbuf_Position);
|
||||
gl.BufferData(GL_TEXTURE_BUFFER, pPos.Size() * sizeof (FLightPosition), &pPos[0], GL_STREAM_DRAW);
|
||||
glBindBuffer(GL_TEXTURE_BUFFER, mIDbuf_Position);
|
||||
glBufferData(GL_TEXTURE_BUFFER, pPos.Size() * sizeof (FLightPosition), &pPos[0], GL_STREAM_DRAW);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -173,8 +173,8 @@ void FLightBuffer::CollectLightSources()
|
|||
|
||||
FLightIndexBuffer::FLightIndexBuffer()
|
||||
{
|
||||
gl.GenBuffers(1, &mIDBuffer);
|
||||
gl.BindBuffer(GL_TEXTURE_BUFFER, mIDBuffer);
|
||||
glGenBuffers(1, &mIDBuffer);
|
||||
glBindBuffer(GL_TEXTURE_BUFFER, mIDBuffer);
|
||||
|
||||
glGenTextures(1, &mIDTexture);
|
||||
glBindTexture(GL_TEXTURE_BUFFER, mIDTexture);
|
||||
|
@ -189,8 +189,8 @@ FLightIndexBuffer::FLightIndexBuffer()
|
|||
|
||||
FLightIndexBuffer::~FLightIndexBuffer()
|
||||
{
|
||||
gl.BindBuffer(GL_TEXTURE_BUFFER, 0);
|
||||
gl.DeleteBuffers(1, &mIDBuffer);
|
||||
glBindBuffer(GL_TEXTURE_BUFFER, 0);
|
||||
glDeleteBuffers(1, &mIDBuffer);
|
||||
|
||||
glBindTexture(GL_TEXTURE_BUFFER, 0);
|
||||
glDeleteTextures(1, &mIDTexture);
|
||||
|
@ -219,9 +219,9 @@ void FLightIndexBuffer::AddLight(ADynamicLight *light)
|
|||
|
||||
void FLightIndexBuffer::SendBuffer()
|
||||
{
|
||||
gl.BindBuffer(GL_TEXTURE_BUFFER, mIDBuffer);
|
||||
gl.BufferData(GL_TEXTURE_BUFFER, mBuffer.Size() * sizeof (short), &mBuffer[0], GL_STREAM_DRAW);
|
||||
gl.BindBuffer(GL_TEXTURE_BUFFER, 0);
|
||||
glBindBuffer(GL_TEXTURE_BUFFER, mIDBuffer);
|
||||
glBufferData(GL_TEXTURE_BUFFER, mBuffer.Size() * sizeof (short), &mBuffer[0], GL_STREAM_DRAW);
|
||||
glBindBuffer(GL_TEXTURE_BUFFER, 0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -233,9 +233,9 @@ void FLightIndexBuffer::SendBuffer()
|
|||
|
||||
void FLightIndexBuffer::BindTexture(int texunit1)
|
||||
{
|
||||
gl.ActiveTexture(texunit1);
|
||||
glActiveTexture(texunit1);
|
||||
glBindTexture(GL_TEXTURE_BUFFER, mIDTexture);
|
||||
gl.ActiveTexture(GL_TEXTURE0);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
//#include "resources/voxels.h"
|
||||
//#include "gl/gl_intern.h"
|
||||
|
||||
#include "gl/system/gl_interface.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/scene/gl_drawinfo.h"
|
||||
#include "gl/models/gl_models.h"
|
||||
|
@ -759,7 +760,7 @@ void gl_RenderModel(GLSprite * spr, int cm)
|
|||
}
|
||||
else
|
||||
{
|
||||
gl.ActiveTexture(GL_TEXTURE7); // Hijack the otherwise unused seventh texture matrix for the model to world transformation.
|
||||
glActiveTexture(GL_TEXTURE7); // Hijack the otherwise unused seventh texture matrix for the model to world transformation.
|
||||
glMatrixMode(GL_TEXTURE);
|
||||
glLoadIdentity();
|
||||
}
|
||||
|
@ -794,7 +795,7 @@ void gl_RenderModel(GLSprite * spr, int cm)
|
|||
glRotatef(smf->pitchoffset, 0, 0, 1);
|
||||
glRotatef(-smf->rolloffset, 1, 0, 0);
|
||||
|
||||
if (gl.shadermodel >= 4) gl.ActiveTexture(GL_TEXTURE0);
|
||||
if (gl.shadermodel >= 4) glActiveTexture(GL_TEXTURE0);
|
||||
|
||||
#if 0
|
||||
if (gl_light_models)
|
||||
|
@ -820,10 +821,10 @@ void gl_RenderModel(GLSprite * spr, int cm)
|
|||
}
|
||||
else
|
||||
{
|
||||
gl.ActiveTexture(GL_TEXTURE7);
|
||||
glActiveTexture(GL_TEXTURE7);
|
||||
glMatrixMode(GL_TEXTURE);
|
||||
glLoadIdentity();
|
||||
gl.ActiveTexture(GL_TEXTURE0);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
}
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
#include "textures/bitmap.h"
|
||||
//#include "gl/gl_intern.h"
|
||||
|
||||
#include "gl/system/gl_interface.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/data/gl_vertexbuffer.h"
|
||||
#include "gl/scene/gl_drawinfo.h"
|
||||
|
@ -189,14 +190,14 @@ FVoxelVertexBuffer::FVoxelVertexBuffer(TArray<FVoxelVertex> &verts, TArray<unsig
|
|||
ibo_id = 0;
|
||||
if (gl.flags&RFL_VBO)
|
||||
{
|
||||
gl.GenBuffers(1, &ibo_id);
|
||||
glGenBuffers(1, &ibo_id);
|
||||
|
||||
gl.BindBuffer(GL_ARRAY_BUFFER, vbo_id);
|
||||
gl.BufferData(GL_ARRAY_BUFFER, verts.Size() * sizeof(FVoxelVertex), &verts[0], GL_STATIC_DRAW);
|
||||
gl.BindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo_id);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbo_id);
|
||||
glBufferData(GL_ARRAY_BUFFER, verts.Size() * sizeof(FVoxelVertex), &verts[0], GL_STATIC_DRAW);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo_id);
|
||||
if (verts.Size() > 65535)
|
||||
{
|
||||
gl.BufferData(GL_ELEMENT_ARRAY_BUFFER, indices.Size() * sizeof(unsigned int), &indices[0], GL_STATIC_DRAW);
|
||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices.Size() * sizeof(unsigned int), &indices[0], GL_STATIC_DRAW);
|
||||
isint = true;
|
||||
}
|
||||
else
|
||||
|
@ -206,7 +207,7 @@ FVoxelVertexBuffer::FVoxelVertexBuffer(TArray<FVoxelVertex> &verts, TArray<unsig
|
|||
{
|
||||
sbuffer[i] = (unsigned short)indices[i];
|
||||
}
|
||||
gl.BufferData(GL_ELEMENT_ARRAY_BUFFER, indices.Size() * sizeof(unsigned short), sbuffer, GL_STATIC_DRAW);
|
||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices.Size() * sizeof(unsigned short), sbuffer, GL_STATIC_DRAW);
|
||||
delete [] sbuffer;
|
||||
isint = false;
|
||||
}
|
||||
|
@ -223,7 +224,7 @@ FVoxelVertexBuffer::~FVoxelVertexBuffer()
|
|||
{
|
||||
if (ibo_id != 0)
|
||||
{
|
||||
gl.DeleteBuffers(1, &ibo_id);
|
||||
glDeleteBuffers(1, &ibo_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -236,8 +237,8 @@ FVoxelVertexBuffer::~FVoxelVertexBuffer()
|
|||
|
||||
void FVoxelVertexBuffer::BindVBO()
|
||||
{
|
||||
gl.BindBuffer(GL_ARRAY_BUFFER, vbo_id);
|
||||
gl.BindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo_id);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbo_id);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo_id);
|
||||
glVertexPointer(3,GL_FLOAT, sizeof(FVoxelVertex), &VVO->x);
|
||||
glTexCoordPointer(2,GL_FLOAT, sizeof(FVoxelVertex), &VVO->u);
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
|
||||
|
||||
#include "gl/system/gl_system.h"
|
||||
#include "gl/system/gl_interface.h"
|
||||
#include "gl/system/gl_cvars.h"
|
||||
#include "gl/data/gl_data.h"
|
||||
#include "gl/renderer/gl_colormap.h"
|
||||
|
@ -339,12 +340,12 @@ void gl_SetColor(int light, int rellight, const FColormap * cm, float alpha, Pal
|
|||
|
||||
if (gl_fixedcolormap)
|
||||
{
|
||||
gl.VertexAttrib1f(VATTR_LIGHTLEVEL, 1.0);
|
||||
glVertexAttrib1f(VATTR_LIGHTLEVEL, 1.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
float lightlevel = gl_CalcLightLevel(light, rellight, weapon) / 255.0f;
|
||||
gl.VertexAttrib1f(VATTR_LIGHTLEVEL, lightlevel);
|
||||
glVertexAttrib1f(VATTR_LIGHTLEVEL, lightlevel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -611,7 +612,7 @@ void gl_SetFog(int lightlevel, int rellight, const FColormap *cmap, bool isaddit
|
|||
|
||||
// Korshun: fullbright fog like in software renderer.
|
||||
if (glset.brightfog && fogdensity != 0 && fogcolor != 0)
|
||||
gl.VertexAttrib1f(VATTR_LIGHTLEVEL, 1.0);
|
||||
glVertexAttrib1f(VATTR_LIGHTLEVEL, 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
#include "gl/gl_functions.h"
|
||||
#include "vectors.h"
|
||||
|
||||
#include "gl/system/gl_interface.h"
|
||||
#include "gl/system/gl_framebuffer.h"
|
||||
#include "gl/system/gl_threads.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
|
@ -123,7 +124,7 @@ FGLRenderer::~FGLRenderer()
|
|||
if (glpart) delete glpart;
|
||||
if (mirrortexture) delete mirrortexture;
|
||||
if (gllight) delete gllight;
|
||||
if (mFBID != 0) gl.DeleteFramebuffers(1, &mFBID);
|
||||
if (mFBID != 0) glDeleteFramebuffers(1, &mFBID);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
@ -213,8 +214,8 @@ bool FGLRenderer::StartOffscreen()
|
|||
{
|
||||
if (gl.flags & RFL_FRAMEBUFFER)
|
||||
{
|
||||
if (mFBID == 0) gl.GenFramebuffers(1, &mFBID);
|
||||
gl.BindFramebuffer(GL_FRAMEBUFFER, mFBID);
|
||||
if (mFBID == 0) glGenFramebuffers(1, &mFBID);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, mFBID);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -230,7 +231,7 @@ void FGLRenderer::EndOffscreen()
|
|||
{
|
||||
if (gl.flags & RFL_FRAMEBUFFER)
|
||||
{
|
||||
gl.BindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
*/
|
||||
|
||||
#include "gl/system/gl_system.h"
|
||||
#include "gl/system/gl_interface.h"
|
||||
#include "gl/data/gl_data.h"
|
||||
#include "gl/system/gl_cvars.h"
|
||||
#include "gl/shaders/gl_shader.h"
|
||||
|
@ -203,15 +204,15 @@ bool FRenderState::ApplyShader()
|
|||
|
||||
if (fogset != activeShader->currentfogenabled)
|
||||
{
|
||||
gl.Uniform1i(activeShader->fogenabled_index, (activeShader->currentfogenabled = fogset));
|
||||
glUniform1i(activeShader->fogenabled_index, (activeShader->currentfogenabled = fogset));
|
||||
}
|
||||
if (mTextureMode != activeShader->currenttexturemode)
|
||||
{
|
||||
gl.Uniform1i(activeShader->texturemode_index, (activeShader->currenttexturemode = mTextureMode));
|
||||
glUniform1i(activeShader->texturemode_index, (activeShader->currenttexturemode = mTextureMode));
|
||||
}
|
||||
if (activeShader->currentcamerapos.Update(&mCameraPos))
|
||||
{
|
||||
gl.Uniform3fv(activeShader->camerapos_index, 1, mCameraPos.vec);
|
||||
glUniform3fv(activeShader->camerapos_index, 1, mCameraPos.vec);
|
||||
}
|
||||
/*if (mLightParms[0] != activeShader->currentlightfactor ||
|
||||
mLightParms[1] != activeShader->currentlightdist ||
|
||||
|
@ -223,28 +224,28 @@ bool FRenderState::ApplyShader()
|
|||
//activeShader->currentfogdensity = mFogDensity;
|
||||
// premultiply the density with as much as possible here to reduce shader
|
||||
// execution time.
|
||||
gl.VertexAttrib4f(VATTR_FOGPARAMS, mLightParms[0], mLightParms[1], mFogDensity * (-LOG2E / 64000.f), 0);
|
||||
glVertexAttrib4f(VATTR_FOGPARAMS, mLightParms[0], mLightParms[1], mFogDensity * (-LOG2E / 64000.f), 0);
|
||||
}
|
||||
if (mFogColor != activeShader->currentfogcolor)
|
||||
{
|
||||
activeShader->currentfogcolor = mFogColor;
|
||||
|
||||
gl.Uniform4f (activeShader->fogcolor_index, mFogColor.r/255.f, mFogColor.g/255.f,
|
||||
glUniform4f (activeShader->fogcolor_index, mFogColor.r/255.f, mFogColor.g/255.f,
|
||||
mFogColor.b/255.f, 0);
|
||||
}
|
||||
if (mGlowEnabled)
|
||||
{
|
||||
gl.Uniform4fv(activeShader->glowtopcolor_index, 1, mGlowTop.vec);
|
||||
gl.Uniform4fv(activeShader->glowbottomcolor_index, 1, mGlowBottom.vec);
|
||||
glUniform4fv(activeShader->glowtopcolor_index, 1, mGlowTop.vec);
|
||||
glUniform4fv(activeShader->glowbottomcolor_index, 1, mGlowBottom.vec);
|
||||
}
|
||||
if (mLightEnabled)
|
||||
{
|
||||
gl.Uniform3iv(activeShader->lightrange_index, 1, mNumLights);
|
||||
gl.Uniform4fv(activeShader->lights_index, mNumLights[2], mLightData);
|
||||
glUniform3iv(activeShader->lightrange_index, 1, mNumLights);
|
||||
glUniform4fv(activeShader->lights_index, mNumLights[2], mLightData);
|
||||
}
|
||||
if (glset.lightmode == 8)
|
||||
{
|
||||
gl.Uniform3fv(activeShader->dlightcolor_index, 1, mDynLight);
|
||||
glUniform3fv(activeShader->dlightcolor_index, 1, mDynLight);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -284,7 +285,7 @@ void FRenderState::Apply(bool forcenoshader)
|
|||
if (mBlendEquation != glBlendEquation)
|
||||
{
|
||||
glBlendEquation = mBlendEquation;
|
||||
gl.BlendEquation(mBlendEquation);
|
||||
::glBlendEquation(mBlendEquation);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -263,7 +263,7 @@ public:
|
|||
}
|
||||
else
|
||||
{
|
||||
gl.BlendEquation(eq);
|
||||
::glBlendEquation(eq);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -368,9 +368,9 @@ void GLWall::DrawDecal(DBaseDecal *decal)
|
|||
if (glset.lightmode == 8)
|
||||
{
|
||||
if (gl_fixedcolormap)
|
||||
gl.VertexAttrib1f(VATTR_LIGHTLEVEL, 1.0);
|
||||
glVertexAttrib1f(VATTR_LIGHTLEVEL, 1.0);
|
||||
else
|
||||
gl.VertexAttrib1f(VATTR_LIGHTLEVEL, gl_CalcLightLevel(light, rel, false) / 255.0);
|
||||
glVertexAttrib1f(VATTR_LIGHTLEVEL, gl_CalcLightLevel(light, rel, false) / 255.0);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include "doomstat.h"
|
||||
#include "d_player.h"
|
||||
|
||||
#include "gl/system/gl_interface.h"
|
||||
#include "gl/system/gl_cvars.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/renderer/gl_lightdata.h"
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include "doomstat.h"
|
||||
#include "a_sharedglobal.h"
|
||||
|
||||
#include "gl/system/gl_interface.h"
|
||||
#include "gl/system/gl_framebuffer.h"
|
||||
#include "gl/system/gl_cvars.h"
|
||||
#include "gl/renderer/gl_lightdata.h"
|
||||
|
@ -199,10 +200,10 @@ bool GLPortal::Start(bool usestencil, bool doquery)
|
|||
// If occlusion query is supported let's use it to avoid rendering portals that aren't visible
|
||||
if (doquery && gl.flags&RFL_OCCLUSION_QUERY)
|
||||
{
|
||||
if (!QueryObject) gl.GenQueries(1, &QueryObject);
|
||||
if (!QueryObject) glGenQueries(1, &QueryObject);
|
||||
if (QueryObject)
|
||||
{
|
||||
gl.BeginQuery(GL_SAMPLES_PASSED_ARB, QueryObject);
|
||||
glBeginQuery(GL_SAMPLES_PASSED_ARB, QueryObject);
|
||||
}
|
||||
else doquery = false; // some kind of error happened
|
||||
|
||||
|
@ -212,7 +213,7 @@ bool GLPortal::Start(bool usestencil, bool doquery)
|
|||
|
||||
if (doquery && gl.flags&RFL_OCCLUSION_QUERY)
|
||||
{
|
||||
gl.EndQuery(GL_SAMPLES_PASSED_ARB);
|
||||
glEndQuery(GL_SAMPLES_PASSED_ARB);
|
||||
}
|
||||
|
||||
// Clear Z-buffer
|
||||
|
@ -233,7 +234,7 @@ bool GLPortal::Start(bool usestencil, bool doquery)
|
|||
{
|
||||
GLuint sampleCount;
|
||||
|
||||
gl.GetQueryObjectuiv(QueryObject, GL_QUERY_RESULT_ARB, &sampleCount);
|
||||
glGetQueryObjectuiv(QueryObject, GL_QUERY_RESULT_ARB, &sampleCount);
|
||||
|
||||
if (sampleCount==0) // not visible
|
||||
{
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
#include "p_local.h"
|
||||
#include "gl/gl_functions.h"
|
||||
|
||||
#include "gl/system/gl_interface.h"
|
||||
#include "gl/system/gl_framebuffer.h"
|
||||
#include "gl/system/gl_cvars.h"
|
||||
#include "gl/renderer/gl_lightdata.h"
|
||||
|
@ -266,11 +267,11 @@ void FGLRenderer::SetViewMatrix(bool mirror, bool planemirror)
|
|||
{
|
||||
if (gl.shadermodel >= 4)
|
||||
{
|
||||
gl.ActiveTexture(GL_TEXTURE7);
|
||||
glActiveTexture(GL_TEXTURE7);
|
||||
glMatrixMode(GL_TEXTURE);
|
||||
glLoadIdentity();
|
||||
}
|
||||
gl.ActiveTexture(GL_TEXTURE0);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glMatrixMode(GL_TEXTURE);
|
||||
glLoadIdentity();
|
||||
|
||||
|
@ -441,7 +442,7 @@ void FGLRenderer::RenderScene(int recursion)
|
|||
{
|
||||
gl_RenderState.BlendFunc(GL_ONE, GL_ONE);
|
||||
glDepthFunc(GL_EQUAL);
|
||||
if (glset.lightmode == 8) gl.VertexAttrib1f(VATTR_LIGHTLEVEL, 1.0f); // Korshun.
|
||||
if (glset.lightmode == 8) glVertexAttrib1f(VATTR_LIGHTLEVEL, 1.0f); // Korshun.
|
||||
for(int i=GLDL_FIRSTLIGHT; i<=GLDL_LASTLIGHT; i++)
|
||||
{
|
||||
gl_drawinfo->drawlists[i].Draw(GLPASS_LIGHT);
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include "r_state.h"
|
||||
//#include "gl/gl_intern.h"
|
||||
|
||||
#include "gl/system/gl_interface.h"
|
||||
#include "gl/data/gl_data.h"
|
||||
#include "gl/renderer/gl_lightdata.h"
|
||||
#include "gl/renderer/gl_renderstate.h"
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include "r_sky.h"
|
||||
#include "r_utility.h"
|
||||
|
||||
#include "gl/system/gl_interface.h"
|
||||
#include "gl/system/gl_framebuffer.h"
|
||||
#include "gl/system/gl_cvars.h"
|
||||
#include "gl/renderer/gl_lightdata.h"
|
||||
|
|
|
@ -159,7 +159,7 @@ static int gl_SetSpriteLight(AActor *self, fixed_t x, fixed_t y, fixed_t z, subs
|
|||
glColor4f(r, g, b, alpha);
|
||||
if (glset.lightmode == 8)
|
||||
{
|
||||
gl.VertexAttrib1f(VATTR_LIGHTLEVEL, gl_CalcLightLevel(lightlevel, rellight, weapon) / 255.0f); // Korshun.
|
||||
glVertexAttrib1f(VATTR_LIGHTLEVEL, gl_CalcLightLevel(lightlevel, rellight, weapon) / 255.0f); // Korshun.
|
||||
gl_RenderState.SetDynLight(result[0], result[1], result[2]);
|
||||
}
|
||||
return lightlevel;
|
||||
|
|
|
@ -82,7 +82,7 @@ void GLWall::SplitUpperEdge(texcoord * tcs, bool glow)
|
|||
|
||||
float fracfac = sidefrac - glseg.fracleft;
|
||||
|
||||
if (glow) gl.VertexAttrib2f(VATTR_GLOWDISTANCE, zceil[0] - ztop[0] + (facc - fact) * fracfac,
|
||||
if (glow) glVertexAttrib2f(VATTR_GLOWDISTANCE, zceil[0] - ztop[0] + (facc - fact) * fracfac,
|
||||
ztop[0] - zfloor[0] + (fact - facf) * fracfac);
|
||||
|
||||
glTexCoord2f(tcs[1].u + facu * fracfac, tcs[1].v + facv * fracfac);
|
||||
|
@ -118,7 +118,7 @@ void GLWall::SplitLowerEdge(texcoord * tcs, bool glow)
|
|||
|
||||
float fracfac = sidefrac - glseg.fracleft;
|
||||
|
||||
if (glow) gl.VertexAttrib2f(VATTR_GLOWDISTANCE, zceil[0] - zbottom[0] + (facc - facb) * fracfac,
|
||||
if (glow) glVertexAttrib2f(VATTR_GLOWDISTANCE, zceil[0] - zbottom[0] + (facc - facb) * fracfac,
|
||||
zbottom[0] - zfloor[0] + (facb - facf) * fracfac);
|
||||
|
||||
glTexCoord2f(tcs[0].u + facu * fracfac, tcs[0].v + facv * fracfac);
|
||||
|
@ -150,7 +150,7 @@ void GLWall::SplitLeftEdge(texcoord * tcs, bool glow)
|
|||
while (i<vi->numheights && vi->heightlist[i] <= zbottom[0] ) i++;
|
||||
while (i<vi->numheights && vi->heightlist[i] < ztop[0])
|
||||
{
|
||||
if (glow) gl.VertexAttrib2f(VATTR_GLOWDISTANCE, zceil[0] - vi->heightlist[i], vi->heightlist[i] - zfloor[0]);
|
||||
if (glow) glVertexAttrib2f(VATTR_GLOWDISTANCE, zceil[0] - vi->heightlist[i], vi->heightlist[i] - zfloor[0]);
|
||||
glTexCoord2f(factu1*(vi->heightlist[i] - ztop[0]) + tcs[1].u,
|
||||
factv1*(vi->heightlist[i] - ztop[0]) + tcs[1].v);
|
||||
glVertex3f(glseg.x1, vi->heightlist[i], glseg.y1);
|
||||
|
@ -183,7 +183,7 @@ void GLWall::SplitRightEdge(texcoord * tcs, bool glow)
|
|||
while (i>0 && vi->heightlist[i] >= ztop[1]) i--;
|
||||
while (i>0 && vi->heightlist[i] > zbottom[1])
|
||||
{
|
||||
if (glow) gl.VertexAttrib2f(VATTR_GLOWDISTANCE, zceil[1] - vi->heightlist[i], vi->heightlist[i] - zfloor[1]);
|
||||
if (glow) glVertexAttrib2f(VATTR_GLOWDISTANCE, zceil[1] - vi->heightlist[i], vi->heightlist[i] - zfloor[1]);
|
||||
glTexCoord2f(factu2 * (vi->heightlist[i] - ztop[1]) + tcs[2].u,
|
||||
factv2 * (vi->heightlist[i] - ztop[1]) + tcs[2].v);
|
||||
glVertex3f(glseg.x2, vi->heightlist[i], glseg.y2);
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "a_sharedglobal.h"
|
||||
#include "gl/gl_functions.h"
|
||||
|
||||
#include "gl/system/gl_interface.h"
|
||||
#include "gl/system/gl_cvars.h"
|
||||
#include "gl/renderer/gl_lightdata.h"
|
||||
#include "gl/renderer/gl_renderstate.h"
|
||||
|
@ -248,14 +249,14 @@ void GLWall::RenderWall(int textured, float * color2, ADynamicLight * light)
|
|||
glBegin(GL_TRIANGLE_FAN);
|
||||
|
||||
// lower left corner
|
||||
if (glowing) gl.VertexAttrib2f(VATTR_GLOWDISTANCE, zceil[0] - zbottom[0], zbottom[0] - zfloor[0]);
|
||||
if (glowing) glVertexAttrib2f(VATTR_GLOWDISTANCE, zceil[0] - zbottom[0], zbottom[0] - zfloor[0]);
|
||||
if (textured&1) glTexCoord2f(tcs[0].u,tcs[0].v);
|
||||
glVertex3f(glseg.x1,zbottom[0],glseg.y1);
|
||||
|
||||
if (split && glseg.fracleft==0) SplitLeftEdge(tcs, glowing);
|
||||
|
||||
// upper left corner
|
||||
if (glowing) gl.VertexAttrib2f(VATTR_GLOWDISTANCE, zceil[0] - ztop[0], ztop[0] - zfloor[0]);
|
||||
if (glowing) glVertexAttrib2f(VATTR_GLOWDISTANCE, zceil[0] - ztop[0], ztop[0] - zfloor[0]);
|
||||
if (textured&1) glTexCoord2f(tcs[1].u,tcs[1].v);
|
||||
glVertex3f(glseg.x1,ztop[0],glseg.y1);
|
||||
|
||||
|
@ -265,14 +266,14 @@ void GLWall::RenderWall(int textured, float * color2, ADynamicLight * light)
|
|||
if (color2) glColor4fv(color2);
|
||||
|
||||
// upper right corner
|
||||
if (glowing) gl.VertexAttrib2f(VATTR_GLOWDISTANCE, zceil[1] - ztop[1], ztop[1] - zfloor[1]);
|
||||
if (glowing) glVertexAttrib2f(VATTR_GLOWDISTANCE, zceil[1] - ztop[1], ztop[1] - zfloor[1]);
|
||||
if (textured&1) glTexCoord2f(tcs[2].u,tcs[2].v);
|
||||
glVertex3f(glseg.x2,ztop[1],glseg.y2);
|
||||
|
||||
if (split && glseg.fracright==1) SplitRightEdge(tcs, glowing);
|
||||
|
||||
// lower right corner
|
||||
if (glowing) gl.VertexAttrib2f(VATTR_GLOWDISTANCE, zceil[1] - zbottom[1], zbottom[1] - zfloor[1]);
|
||||
if (glowing) glVertexAttrib2f(VATTR_GLOWDISTANCE, zceil[1] - zbottom[1], zbottom[1] - zfloor[1]);
|
||||
if (textured&1) glTexCoord2f(tcs[3].u,tcs[3].v);
|
||||
glVertex3f(glseg.x2,zbottom[1],glseg.y2);
|
||||
|
||||
|
@ -330,7 +331,7 @@ void GLWall::RenderFogBoundary()
|
|||
gl_RenderState.AlphaFunc(GL_GREATER,0);
|
||||
glDepthFunc(GL_LEQUAL);
|
||||
glColor4f(fc[0],fc[1],fc[2], fogd1);
|
||||
if (glset.lightmode == 8) gl.VertexAttrib1f(VATTR_LIGHTLEVEL, 1.0); // Korshun.
|
||||
if (glset.lightmode == 8) glVertexAttrib1f(VATTR_LIGHTLEVEL, 1.0); // Korshun.
|
||||
|
||||
flags &= ~GLWF_GLOW;
|
||||
RenderWall(4,fc);
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include "d_player.h"
|
||||
#include "g_level.h"
|
||||
|
||||
#include "gl/system/gl_interface.h"
|
||||
#include "gl/system/gl_cvars.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/renderer/gl_lightdata.h"
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
#include "sc_man.h"
|
||||
#include "cmdlib.h"
|
||||
|
||||
#include "gl/system/gl_interface.h"
|
||||
#include "gl/data/gl_data.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/renderer/gl_renderstate.h"
|
||||
|
@ -119,8 +120,8 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
|||
}
|
||||
}
|
||||
|
||||
hVertProg = gl.CreateShader(GL_VERTEX_SHADER);
|
||||
hFragProg = gl.CreateShader(GL_FRAGMENT_SHADER);
|
||||
hVertProg = glCreateShader(GL_VERTEX_SHADER);
|
||||
hFragProg = glCreateShader(GL_FRAGMENT_SHADER);
|
||||
|
||||
|
||||
int vp_size = (int)vp_comb.Len();
|
||||
|
@ -129,68 +130,68 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
|||
const char *vp_ptr = vp_comb.GetChars();
|
||||
const char *fp_ptr = fp_comb.GetChars();
|
||||
|
||||
gl.ShaderSource(hVertProg, 1, &vp_ptr, &vp_size);
|
||||
gl.ShaderSource(hFragProg, 1, &fp_ptr, &fp_size);
|
||||
glShaderSource(hVertProg, 1, &vp_ptr, &vp_size);
|
||||
glShaderSource(hFragProg, 1, &fp_ptr, &fp_size);
|
||||
|
||||
gl.CompileShader(hVertProg);
|
||||
gl.CompileShader(hFragProg);
|
||||
glCompileShader(hVertProg);
|
||||
glCompileShader(hFragProg);
|
||||
|
||||
hShader = gl.CreateProgram();
|
||||
hShader = glCreateProgram();
|
||||
|
||||
gl.AttachShader(hShader, hVertProg);
|
||||
gl.AttachShader(hShader, hFragProg);
|
||||
glAttachShader(hShader, hVertProg);
|
||||
glAttachShader(hShader, hFragProg);
|
||||
|
||||
gl.BindAttribLocation(hShader, VATTR_GLOWDISTANCE, "glowdistance");
|
||||
gl.BindAttribLocation(hShader, VATTR_FOGPARAMS, "fogparams");
|
||||
gl.BindAttribLocation(hShader, VATTR_LIGHTLEVEL, "lightlevel_in"); // Korshun.
|
||||
glBindAttribLocation(hShader, VATTR_GLOWDISTANCE, "glowdistance");
|
||||
glBindAttribLocation(hShader, VATTR_FOGPARAMS, "fogparams");
|
||||
glBindAttribLocation(hShader, VATTR_LIGHTLEVEL, "lightlevel_in"); // Korshun.
|
||||
|
||||
gl.LinkProgram(hShader);
|
||||
glLinkProgram(hShader);
|
||||
|
||||
gl.GetShaderInfoLog(hVertProg, 10000, NULL, buffer);
|
||||
glGetShaderInfoLog(hVertProg, 10000, NULL, buffer);
|
||||
if (*buffer)
|
||||
{
|
||||
error << "Vertex shader:\n" << buffer << "\n";
|
||||
}
|
||||
gl.GetShaderInfoLog(hFragProg, 10000, NULL, buffer);
|
||||
glGetShaderInfoLog(hFragProg, 10000, NULL, buffer);
|
||||
if (*buffer)
|
||||
{
|
||||
error << "Vertex shader:\n" << buffer << "\n";
|
||||
}
|
||||
|
||||
gl.GetProgramInfoLog(hShader, 10000, NULL, buffer);
|
||||
glGetProgramInfoLog(hShader, 10000, NULL, buffer);
|
||||
if (*buffer)
|
||||
{
|
||||
error << "Linking:\n" << buffer << "\n";
|
||||
}
|
||||
int linked;
|
||||
gl.GetObjectParameteriv(hShader, GL_LINK_STATUS, &linked);
|
||||
glGetObjectParameteriv(hShader, GL_LINK_STATUS, &linked);
|
||||
if (linked == 0)
|
||||
{
|
||||
// only print message if there's an error.
|
||||
Printf("Init Shader '%s':\n%s\n", name, error.GetChars());
|
||||
}
|
||||
timer_index = gl.GetUniformLocation(hShader, "timer");
|
||||
desaturation_index = gl.GetUniformLocation(hShader, "desaturation_factor");
|
||||
fogenabled_index = gl.GetUniformLocation(hShader, "fogenabled");
|
||||
texturemode_index = gl.GetUniformLocation(hShader, "texturemode");
|
||||
camerapos_index = gl.GetUniformLocation(hShader, "camerapos");
|
||||
lightparms_index = gl.GetUniformLocation(hShader, "lightparms");
|
||||
colormapstart_index = gl.GetUniformLocation(hShader, "colormapstart");
|
||||
colormaprange_index = gl.GetUniformLocation(hShader, "colormaprange");
|
||||
lightrange_index = gl.GetUniformLocation(hShader, "lightrange");
|
||||
fogcolor_index = gl.GetUniformLocation(hShader, "fogcolor");
|
||||
lights_index = gl.GetUniformLocation(hShader, "lights");
|
||||
dlightcolor_index = gl.GetUniformLocation(hShader, "dlightcolor");
|
||||
timer_index = glGetUniformLocation(hShader, "timer");
|
||||
desaturation_index = glGetUniformLocation(hShader, "desaturation_factor");
|
||||
fogenabled_index = glGetUniformLocation(hShader, "fogenabled");
|
||||
texturemode_index = glGetUniformLocation(hShader, "texturemode");
|
||||
camerapos_index = glGetUniformLocation(hShader, "camerapos");
|
||||
lightparms_index = glGetUniformLocation(hShader, "lightparms");
|
||||
colormapstart_index = glGetUniformLocation(hShader, "colormapstart");
|
||||
colormaprange_index = glGetUniformLocation(hShader, "colormaprange");
|
||||
lightrange_index = glGetUniformLocation(hShader, "lightrange");
|
||||
fogcolor_index = glGetUniformLocation(hShader, "fogcolor");
|
||||
lights_index = glGetUniformLocation(hShader, "lights");
|
||||
dlightcolor_index = glGetUniformLocation(hShader, "dlightcolor");
|
||||
|
||||
glowbottomcolor_index = gl.GetUniformLocation(hShader, "bottomglowcolor");
|
||||
glowtopcolor_index = gl.GetUniformLocation(hShader, "topglowcolor");
|
||||
glowbottomcolor_index = glGetUniformLocation(hShader, "bottomglowcolor");
|
||||
glowtopcolor_index = glGetUniformLocation(hShader, "topglowcolor");
|
||||
|
||||
gl.UseProgram(hShader);
|
||||
glUseProgram(hShader);
|
||||
|
||||
int texture_index = gl.GetUniformLocation(hShader, "texture2");
|
||||
if (texture_index > 0) gl.Uniform1i(texture_index, 1);
|
||||
int texture_index = glGetUniformLocation(hShader, "texture2");
|
||||
if (texture_index > 0) glUniform1i(texture_index, 1);
|
||||
|
||||
gl.UseProgram(0);
|
||||
glUseProgram(0);
|
||||
return !!linked;
|
||||
}
|
||||
return false;
|
||||
|
@ -204,9 +205,9 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
|||
|
||||
FShader::~FShader()
|
||||
{
|
||||
gl.DeleteProgram(hShader);
|
||||
gl.DeleteShader(hVertProg);
|
||||
gl.DeleteShader(hFragProg);
|
||||
glDeleteProgram(hShader);
|
||||
glDeleteShader(hVertProg);
|
||||
glDeleteShader(hFragProg);
|
||||
}
|
||||
|
||||
|
||||
|
@ -219,7 +220,7 @@ FShader::~FShader()
|
|||
bool FShader::Bind(float Speed)
|
||||
{
|
||||
GLRenderer->mShaderManager->SetActiveShader(this);
|
||||
if (timer_index >=0 && Speed > 0.f) gl.Uniform1f(timer_index, gl_frameMS*Speed/1000.f);
|
||||
if (timer_index >=0 && Speed > 0.f) glUniform1f(timer_index, gl_frameMS*Speed/1000.f);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -376,8 +377,8 @@ FShader *FShaderContainer::Bind(int cm, bool glowing, float Speed, bool lights)
|
|||
float m[3]= {map->ColorizeEnd[0] - map->ColorizeStart[0],
|
||||
map->ColorizeEnd[1] - map->ColorizeStart[1], map->ColorizeEnd[2] - map->ColorizeStart[2]};
|
||||
|
||||
gl.Uniform3fv(sh->colormapstart_index, 1, map->ColorizeStart);
|
||||
gl.Uniform3fv(sh->colormaprange_index, 1, m);
|
||||
glUniform3fv(sh->colormapstart_index, 1, map->ColorizeStart);
|
||||
glUniform3fv(sh->colormaprange_index, 1, m);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -390,7 +391,7 @@ FShader *FShaderContainer::Bind(int cm, bool glowing, float Speed, bool lights)
|
|||
sh->Bind(Speed);
|
||||
if (desat)
|
||||
{
|
||||
gl.Uniform1f(sh->desaturation_index, 1.f-float(cm-CM_DESAT0)/(CM_DESAT31-CM_DESAT0));
|
||||
glUniform1f(sh->desaturation_index, 1.f-float(cm-CM_DESAT0)/(CM_DESAT31-CM_DESAT0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -578,7 +579,7 @@ void FShaderManager::SetActiveShader(FShader *sh)
|
|||
// shadermodel needs to be tested here because without it UseProgram will be NULL.
|
||||
if (gl.shadermodel > 0 && mActiveShader != sh)
|
||||
{
|
||||
gl.UseProgram(sh == NULL? 0 : sh->GetHandle());
|
||||
glUseProgram(sh == NULL? 0 : sh->GetHandle());
|
||||
mActiveShader = sh;
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
|
@ -43,6 +43,7 @@
|
|||
#include "version.h"
|
||||
#include "i_system.h"
|
||||
#include "v_text.h"
|
||||
#include "gl/system/gl_interface.h"
|
||||
#include "gl/system/gl_cvars.h"
|
||||
|
||||
#if defined (__unix__) || defined (__APPLE__)
|
||||
|
@ -116,7 +117,7 @@ static bool CheckExtension(const char *ext)
|
|||
static void InitContext()
|
||||
{
|
||||
gl.flags=0;
|
||||
gl.BlendEquation = glBlendEquationDummy;
|
||||
glBlendEquation = glBlendEquationDummy;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -151,11 +152,11 @@ void gl_LoadExtensions()
|
|||
gl.vendorstring=(char*)glGetString(GL_VENDOR);
|
||||
|
||||
// First try the regular function
|
||||
gl.BlendEquation = (PFNGLBLENDEQUATIONPROC)wglGetProcAddress("glBlendEquation");
|
||||
glBlendEquation = (PFNGLBLENDEQUATIONPROC)wglGetProcAddress("glBlendEquation");
|
||||
// If that fails try the EXT version
|
||||
if (!gl.BlendEquation) gl.BlendEquation = (PFNGLBLENDEQUATIONPROC)wglGetProcAddress("glBlendEquationEXT");
|
||||
if (!glBlendEquation) glBlendEquation = (PFNGLBLENDEQUATIONPROC)wglGetProcAddress("glBlendEquationEXT");
|
||||
// If that fails use a no-op dummy
|
||||
if (!gl.BlendEquation) gl.BlendEquation = glBlendEquationDummy;
|
||||
if (!glBlendEquation) glBlendEquation = glBlendEquationDummy;
|
||||
|
||||
if (CheckExtension("GL_ARB_texture_non_power_of_two")) gl.flags|=RFL_NPOT_TEXTURE;
|
||||
if (CheckExtension("GL_ARB_texture_compression")) gl.flags|=RFL_TEXTURE_COMPRESSION;
|
||||
|
@ -172,64 +173,64 @@ void gl_LoadExtensions()
|
|||
|
||||
if (gl.flags & RFL_GL_20)
|
||||
{
|
||||
gl.DeleteShader = (PFNGLDELETESHADERPROC)wglGetProcAddress("glDeleteShader");
|
||||
gl.DeleteProgram = (PFNGLDELETEPROGRAMPROC)wglGetProcAddress("glDeleteProgram");
|
||||
gl.DetachShader = (PFNGLDETACHSHADERPROC)wglGetProcAddress("glDetachShader");
|
||||
gl.CreateShader = (PFNGLCREATESHADERPROC)wglGetProcAddress("glCreateShader");
|
||||
gl.ShaderSource = (PFNGLSHADERSOURCEPROC)wglGetProcAddress("glShaderSource");
|
||||
gl.CompileShader = (PFNGLCOMPILESHADERPROC)wglGetProcAddress("glCompileShader");
|
||||
gl.CreateProgram = (PFNGLCREATEPROGRAMPROC)wglGetProcAddress("glCreateProgram");
|
||||
gl.AttachShader = (PFNGLATTACHSHADERPROC)wglGetProcAddress("glAttachShader");
|
||||
gl.LinkProgram = (PFNGLLINKPROGRAMPROC)wglGetProcAddress("glLinkProgram");
|
||||
gl.UseProgram = (PFNGLUSEPROGRAMPROC)wglGetProcAddress("glUseProgram");
|
||||
gl.ValidateProgram = (PFNGLVALIDATEPROGRAMPROC)wglGetProcAddress("glValidateProgram");
|
||||
glDeleteShader = (PFNGLDELETESHADERPROC)wglGetProcAddress("glDeleteShader");
|
||||
glDeleteProgram = (PFNGLDELETEPROGRAMPROC)wglGetProcAddress("glDeleteProgram");
|
||||
glDetachShader = (PFNGLDETACHSHADERPROC)wglGetProcAddress("glDetachShader");
|
||||
glCreateShader = (PFNGLCREATESHADERPROC)wglGetProcAddress("glCreateShader");
|
||||
glShaderSource = (PFNGLSHADERSOURCEPROC)wglGetProcAddress("glShaderSource");
|
||||
glCompileShader = (PFNGLCOMPILESHADERPROC)wglGetProcAddress("glCompileShader");
|
||||
glCreateProgram = (PFNGLCREATEPROGRAMPROC)wglGetProcAddress("glCreateProgram");
|
||||
glAttachShader = (PFNGLATTACHSHADERPROC)wglGetProcAddress("glAttachShader");
|
||||
glLinkProgram = (PFNGLLINKPROGRAMPROC)wglGetProcAddress("glLinkProgram");
|
||||
glUseProgram = (PFNGLUSEPROGRAMPROC)wglGetProcAddress("glUseProgram");
|
||||
glValidateProgram = (PFNGLVALIDATEPROGRAMPROC)wglGetProcAddress("glValidateProgram");
|
||||
|
||||
gl.VertexAttrib1f = (PFNGLVERTEXATTRIB1FPROC)wglGetProcAddress("glVertexAttrib1f");
|
||||
gl.VertexAttrib2f = (PFNGLVERTEXATTRIB2FPROC)wglGetProcAddress("glVertexAttrib2f");
|
||||
gl.VertexAttrib4f = (PFNGLVERTEXATTRIB4FPROC)wglGetProcAddress("glVertexAttrib4f");
|
||||
gl.VertexAttrib2fv = (PFNGLVERTEXATTRIB4FVPROC)wglGetProcAddress("glVertexAttrib2fv");
|
||||
gl.VertexAttrib3fv = (PFNGLVERTEXATTRIB4FVPROC)wglGetProcAddress("glVertexAttrib3fv");
|
||||
gl.VertexAttrib4fv = (PFNGLVERTEXATTRIB4FVPROC)wglGetProcAddress("glVertexAttrib4fv");
|
||||
gl.VertexAttrib4ubv = (PFNGLVERTEXATTRIB4UBVPROC)wglGetProcAddress("glVertexAttrib4ubv");
|
||||
gl.GetAttribLocation = (PFNGLGETATTRIBLOCATIONPROC)wglGetProcAddress("glGetAttribLocation");
|
||||
gl.BindAttribLocation = (PFNGLBINDATTRIBLOCATIONPROC)wglGetProcAddress("glBindAttribLocation");
|
||||
glVertexAttrib1f = (PFNGLVERTEXATTRIB1FPROC)wglGetProcAddress("glVertexAttrib1f");
|
||||
glVertexAttrib2f = (PFNGLVERTEXATTRIB2FPROC)wglGetProcAddress("glVertexAttrib2f");
|
||||
glVertexAttrib4f = (PFNGLVERTEXATTRIB4FPROC)wglGetProcAddress("glVertexAttrib4f");
|
||||
glVertexAttrib2fv = (PFNGLVERTEXATTRIB4FVPROC)wglGetProcAddress("glVertexAttrib2fv");
|
||||
glVertexAttrib3fv = (PFNGLVERTEXATTRIB4FVPROC)wglGetProcAddress("glVertexAttrib3fv");
|
||||
glVertexAttrib4fv = (PFNGLVERTEXATTRIB4FVPROC)wglGetProcAddress("glVertexAttrib4fv");
|
||||
glVertexAttrib4ubv = (PFNGLVERTEXATTRIB4UBVPROC)wglGetProcAddress("glVertexAttrib4ubv");
|
||||
glGetAttribLocation = (PFNGLGETATTRIBLOCATIONPROC)wglGetProcAddress("glGetAttribLocation");
|
||||
glBindAttribLocation = (PFNGLBINDATTRIBLOCATIONPROC)wglGetProcAddress("glBindAttribLocation");
|
||||
|
||||
|
||||
gl.Uniform1f = (PFNGLUNIFORM1FPROC)wglGetProcAddress("glUniform1f");
|
||||
gl.Uniform2f = (PFNGLUNIFORM2FPROC)wglGetProcAddress("glUniform2f");
|
||||
gl.Uniform3f = (PFNGLUNIFORM3FPROC)wglGetProcAddress("glUniform3f");
|
||||
gl.Uniform4f = (PFNGLUNIFORM4FPROC)wglGetProcAddress("glUniform4f");
|
||||
gl.Uniform1i = (PFNGLUNIFORM1IPROC)wglGetProcAddress("glUniform1i");
|
||||
gl.Uniform2i = (PFNGLUNIFORM2IPROC)wglGetProcAddress("glUniform2i");
|
||||
gl.Uniform3i = (PFNGLUNIFORM3IPROC)wglGetProcAddress("glUniform3i");
|
||||
gl.Uniform4i = (PFNGLUNIFORM4IPROC)wglGetProcAddress("glUniform4i");
|
||||
gl.Uniform1fv = (PFNGLUNIFORM1FVPROC)wglGetProcAddress("glUniform1fv");
|
||||
gl.Uniform2fv = (PFNGLUNIFORM2FVPROC)wglGetProcAddress("glUniform2fv");
|
||||
gl.Uniform3fv = (PFNGLUNIFORM3FVPROC)wglGetProcAddress("glUniform3fv");
|
||||
gl.Uniform4fv = (PFNGLUNIFORM4FVPROC)wglGetProcAddress("glUniform4fv");
|
||||
gl.Uniform1iv = (PFNGLUNIFORM1IVPROC)wglGetProcAddress("glUniform1iv");
|
||||
gl.Uniform2iv = (PFNGLUNIFORM2IVPROC)wglGetProcAddress("glUniform2iv");
|
||||
gl.Uniform3iv = (PFNGLUNIFORM3IVPROC)wglGetProcAddress("glUniform3iv");
|
||||
gl.Uniform4iv = (PFNGLUNIFORM4IVPROC)wglGetProcAddress("glUniform4iv");
|
||||
glUniform1f = (PFNGLUNIFORM1FPROC)wglGetProcAddress("glUniform1f");
|
||||
glUniform2f = (PFNGLUNIFORM2FPROC)wglGetProcAddress("glUniform2f");
|
||||
glUniform3f = (PFNGLUNIFORM3FPROC)wglGetProcAddress("glUniform3f");
|
||||
glUniform4f = (PFNGLUNIFORM4FPROC)wglGetProcAddress("glUniform4f");
|
||||
glUniform1i = (PFNGLUNIFORM1IPROC)wglGetProcAddress("glUniform1i");
|
||||
glUniform2i = (PFNGLUNIFORM2IPROC)wglGetProcAddress("glUniform2i");
|
||||
glUniform3i = (PFNGLUNIFORM3IPROC)wglGetProcAddress("glUniform3i");
|
||||
glUniform4i = (PFNGLUNIFORM4IPROC)wglGetProcAddress("glUniform4i");
|
||||
glUniform1fv = (PFNGLUNIFORM1FVPROC)wglGetProcAddress("glUniform1fv");
|
||||
glUniform2fv = (PFNGLUNIFORM2FVPROC)wglGetProcAddress("glUniform2fv");
|
||||
glUniform3fv = (PFNGLUNIFORM3FVPROC)wglGetProcAddress("glUniform3fv");
|
||||
glUniform4fv = (PFNGLUNIFORM4FVPROC)wglGetProcAddress("glUniform4fv");
|
||||
glUniform1iv = (PFNGLUNIFORM1IVPROC)wglGetProcAddress("glUniform1iv");
|
||||
glUniform2iv = (PFNGLUNIFORM2IVPROC)wglGetProcAddress("glUniform2iv");
|
||||
glUniform3iv = (PFNGLUNIFORM3IVPROC)wglGetProcAddress("glUniform3iv");
|
||||
glUniform4iv = (PFNGLUNIFORM4IVPROC)wglGetProcAddress("glUniform4iv");
|
||||
|
||||
gl.UniformMatrix2fv = (PFNGLUNIFORMMATRIX2FVPROC)wglGetProcAddress("glUniformMatrix2fv");
|
||||
gl.UniformMatrix3fv = (PFNGLUNIFORMMATRIX3FVPROC)wglGetProcAddress("glUniformMatrix3fv");
|
||||
gl.UniformMatrix4fv = (PFNGLUNIFORMMATRIX4FVPROC)wglGetProcAddress("glUniformMatrix4fv");
|
||||
glUniformMatrix2fv = (PFNGLUNIFORMMATRIX2FVPROC)wglGetProcAddress("glUniformMatrix2fv");
|
||||
glUniformMatrix3fv = (PFNGLUNIFORMMATRIX3FVPROC)wglGetProcAddress("glUniformMatrix3fv");
|
||||
glUniformMatrix4fv = (PFNGLUNIFORMMATRIX4FVPROC)wglGetProcAddress("glUniformMatrix4fv");
|
||||
|
||||
gl.GetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC)wglGetProcAddress("glGetProgramInfoLog");
|
||||
gl.GetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC)wglGetProcAddress("glGetShaderInfoLog");
|
||||
gl.GetUniformLocation = (PFNGLGETUNIFORMLOCATIONPROC)wglGetProcAddress("glGetUniformLocation");
|
||||
gl.GetActiveUniform = (PFNGLGETACTIVEUNIFORMPROC)wglGetProcAddress("glGetActiveUniform");
|
||||
gl.GetUniformfv = (PFNGLGETUNIFORMFVPROC)wglGetProcAddress("glGetUniformfv");
|
||||
gl.GetUniformiv = (PFNGLGETUNIFORMIVPROC)wglGetProcAddress("glGetUniformiv");
|
||||
gl.GetShaderSource = (PFNGLGETSHADERSOURCEPROC)wglGetProcAddress("glGetShaderSource");
|
||||
glGetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC)wglGetProcAddress("glGetProgramInfoLog");
|
||||
glGetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC)wglGetProcAddress("glGetShaderInfoLog");
|
||||
glGetUniformLocation = (PFNGLGETUNIFORMLOCATIONPROC)wglGetProcAddress("glGetUniformLocation");
|
||||
glGetActiveUniform = (PFNGLGETACTIVEUNIFORMPROC)wglGetProcAddress("glGetActiveUniform");
|
||||
glGetUniformfv = (PFNGLGETUNIFORMFVPROC)wglGetProcAddress("glGetUniformfv");
|
||||
glGetUniformiv = (PFNGLGETUNIFORMIVPROC)wglGetProcAddress("glGetUniformiv");
|
||||
glGetShaderSource = (PFNGLGETSHADERSOURCEPROC)wglGetProcAddress("glGetShaderSource");
|
||||
|
||||
gl.EnableVertexAttribArray = (PFNGLENABLEVERTEXATTRIBARRAYPROC)wglGetProcAddress("glEnableVertexAttribArray");
|
||||
gl.DisableVertexAttribArray= (PFNGLDISABLEVERTEXATTRIBARRAYPROC)wglGetProcAddress("glDisableVertexAttribArray");
|
||||
gl.VertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERPROC)wglGetProcAddress("glVertexAttribPointer");
|
||||
glEnableVertexAttribArray = (PFNGLENABLEVERTEXATTRIBARRAYPROC)wglGetProcAddress("glEnableVertexAttribArray");
|
||||
glDisableVertexAttribArray= (PFNGLDISABLEVERTEXATTRIBARRAYPROC)wglGetProcAddress("glDisableVertexAttribArray");
|
||||
glVertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERPROC)wglGetProcAddress("glVertexAttribPointer");
|
||||
|
||||
// what'S the equivalent of this in GL 2.0???
|
||||
gl.GetObjectParameteriv = (PFNGLGETOBJECTPARAMETERIVARBPROC)wglGetProcAddress("glGetObjectParameterivARB");
|
||||
glGetObjectParameteriv = (PFNGLGETOBJECTPARAMETERIVARBPROC)wglGetProcAddress("glGetObjectParameterivARB");
|
||||
|
||||
// Rules:
|
||||
// SM4 will always use shaders. No option to switch them off is needed here.
|
||||
|
@ -250,55 +251,55 @@ void gl_LoadExtensions()
|
|||
|
||||
if (CheckExtension("GL_ARB_occlusion_query"))
|
||||
{
|
||||
gl.GenQueries = (PFNGLGENQUERIESARBPROC)wglGetProcAddress("glGenQueriesARB");
|
||||
gl.DeleteQueries = (PFNGLDELETEQUERIESARBPROC)wglGetProcAddress("glDeleteQueriesARB");
|
||||
gl.GetQueryObjectuiv = (PFNGLGETQUERYOBJECTUIVARBPROC)wglGetProcAddress("glGetQueryObjectuivARB");
|
||||
gl.BeginQuery = (PFNGLBEGINQUERYARBPROC)wglGetProcAddress("glBeginQueryARB");
|
||||
gl.EndQuery = (PFNGLENDQUERYPROC)wglGetProcAddress("glEndQueryARB");
|
||||
glGenQueries = (PFNGLGENQUERIESARBPROC)wglGetProcAddress("glGenQueriesARB");
|
||||
glDeleteQueries = (PFNGLDELETEQUERIESARBPROC)wglGetProcAddress("glDeleteQueriesARB");
|
||||
glGetQueryObjectuiv = (PFNGLGETQUERYOBJECTUIVARBPROC)wglGetProcAddress("glGetQueryObjectuivARB");
|
||||
glBeginQuery = (PFNGLBEGINQUERYARBPROC)wglGetProcAddress("glBeginQueryARB");
|
||||
glEndQuery = (PFNGLENDQUERYPROC)wglGetProcAddress("glEndQueryARB");
|
||||
gl.flags|=RFL_OCCLUSION_QUERY;
|
||||
}
|
||||
|
||||
if (gl.flags & RFL_GL_21)
|
||||
{
|
||||
gl.BindBuffer = (PFNGLBINDBUFFERPROC)wglGetProcAddress("glBindBuffer");
|
||||
gl.DeleteBuffers = (PFNGLDELETEBUFFERSPROC)wglGetProcAddress("glDeleteBuffers");
|
||||
gl.GenBuffers = (PFNGLGENBUFFERSPROC)wglGetProcAddress("glGenBuffers");
|
||||
gl.BufferData = (PFNGLBUFFERDATAPROC)wglGetProcAddress("glBufferData");
|
||||
gl.BufferSubData = (PFNGLBUFFERSUBDATAPROC)wglGetProcAddress("glBufferSubData");
|
||||
gl.MapBuffer = (PFNGLMAPBUFFERPROC)wglGetProcAddress("glMapBuffer");
|
||||
gl.UnmapBuffer = (PFNGLUNMAPBUFFERPROC)wglGetProcAddress("glUnmapBuffer");
|
||||
glBindBuffer = (PFNGLBINDBUFFERPROC)wglGetProcAddress("glBindBuffer");
|
||||
glDeleteBuffers = (PFNGLDELETEBUFFERSPROC)wglGetProcAddress("glDeleteBuffers");
|
||||
glGenBuffers = (PFNGLGENBUFFERSPROC)wglGetProcAddress("glGenBuffers");
|
||||
glBufferData = (PFNGLBUFFERDATAPROC)wglGetProcAddress("glBufferData");
|
||||
glBufferSubData = (PFNGLBUFFERSUBDATAPROC)wglGetProcAddress("glBufferSubData");
|
||||
glMapBuffer = (PFNGLMAPBUFFERPROC)wglGetProcAddress("glMapBuffer");
|
||||
glUnmapBuffer = (PFNGLUNMAPBUFFERPROC)wglGetProcAddress("glUnmapBuffer");
|
||||
gl.flags |= RFL_VBO;
|
||||
}
|
||||
else if (CheckExtension("GL_ARB_vertex_buffer_object"))
|
||||
{
|
||||
gl.BindBuffer = (PFNGLBINDBUFFERPROC)wglGetProcAddress("glBindBufferARB");
|
||||
gl.DeleteBuffers = (PFNGLDELETEBUFFERSPROC)wglGetProcAddress("glDeleteBuffersARB");
|
||||
gl.GenBuffers = (PFNGLGENBUFFERSPROC)wglGetProcAddress("glGenBuffersARB");
|
||||
gl.BufferData = (PFNGLBUFFERDATAPROC)wglGetProcAddress("glBufferDataARB");
|
||||
gl.BufferSubData = (PFNGLBUFFERSUBDATAPROC)wglGetProcAddress("glBufferSubDataARB");
|
||||
gl.MapBuffer = (PFNGLMAPBUFFERPROC)wglGetProcAddress("glMapBufferARB");
|
||||
gl.UnmapBuffer = (PFNGLUNMAPBUFFERPROC)wglGetProcAddress("glUnmapBufferARB");
|
||||
glBindBuffer = (PFNGLBINDBUFFERPROC)wglGetProcAddress("glBindBufferARB");
|
||||
glDeleteBuffers = (PFNGLDELETEBUFFERSPROC)wglGetProcAddress("glDeleteBuffersARB");
|
||||
glGenBuffers = (PFNGLGENBUFFERSPROC)wglGetProcAddress("glGenBuffersARB");
|
||||
glBufferData = (PFNGLBUFFERDATAPROC)wglGetProcAddress("glBufferDataARB");
|
||||
glBufferSubData = (PFNGLBUFFERSUBDATAPROC)wglGetProcAddress("glBufferSubDataARB");
|
||||
glMapBuffer = (PFNGLMAPBUFFERPROC)wglGetProcAddress("glMapBufferARB");
|
||||
glUnmapBuffer = (PFNGLUNMAPBUFFERPROC)wglGetProcAddress("glUnmapBufferARB");
|
||||
gl.flags |= RFL_VBO;
|
||||
}
|
||||
|
||||
if (CheckExtension("GL_ARB_map_buffer_range"))
|
||||
{
|
||||
gl.MapBufferRange = (PFNGLMAPBUFFERRANGEPROC)wglGetProcAddress("glMapBufferRange");
|
||||
gl.FlushMappedBufferRange = (PFNGLFLUSHMAPPEDBUFFERRANGEPROC)wglGetProcAddress("glFlushMappedBufferRange");
|
||||
glMapBufferRange = (PFNGLMAPBUFFERRANGEPROC)wglGetProcAddress("glMapBufferRange");
|
||||
glFlushMappedBufferRange = (PFNGLFLUSHMAPPEDBUFFERRANGEPROC)wglGetProcAddress("glFlushMappedBufferRange");
|
||||
gl.flags|=RFL_MAP_BUFFER_RANGE;
|
||||
}
|
||||
|
||||
if (CheckExtension("GL_ARB_framebuffer_object"))
|
||||
{
|
||||
gl.GenFramebuffers = (PFNGLGENFRAMEBUFFERSPROC)wglGetProcAddress("glGenFramebuffers");
|
||||
gl.DeleteFramebuffers = (PFNGLDELETEFRAMEBUFFERSPROC)wglGetProcAddress("glDeleteFramebuffers");
|
||||
gl.BindFramebuffer = (PFNGLBINDFRAMEBUFFERPROC)wglGetProcAddress("glBindFramebuffer");
|
||||
gl.FramebufferTexture2D = (PFNGLFRAMEBUFFERTEXTURE2DPROC)wglGetProcAddress("glFramebufferTexture2D");
|
||||
gl.GenRenderbuffers = (PFNGLGENRENDERBUFFERSPROC)wglGetProcAddress("glGenRenderbuffers");
|
||||
gl.DeleteRenderbuffers = (PFNGLDELETERENDERBUFFERSPROC)wglGetProcAddress("glDeleteRenderbuffers");
|
||||
gl.BindRenderbuffer = (PFNGLBINDRENDERBUFFERPROC)wglGetProcAddress("glBindRenderbuffer");
|
||||
gl.RenderbufferStorage = (PFNGLRENDERBUFFERSTORAGEPROC)wglGetProcAddress("glRenderbufferStorage");
|
||||
gl.FramebufferRenderbuffer = (PFNGLFRAMEBUFFERRENDERBUFFERPROC)wglGetProcAddress("glFramebufferRenderbuffer");
|
||||
glGenFramebuffers = (PFNGLGENFRAMEBUFFERSPROC)wglGetProcAddress("glGenFramebuffers");
|
||||
glDeleteFramebuffers = (PFNGLDELETEFRAMEBUFFERSPROC)wglGetProcAddress("glDeleteFramebuffers");
|
||||
glBindFramebuffer = (PFNGLBINDFRAMEBUFFERPROC)wglGetProcAddress("glBindFramebuffer");
|
||||
glFramebufferTexture2D = (PFNGLFRAMEBUFFERTEXTURE2DPROC)wglGetProcAddress("glFramebufferTexture2D");
|
||||
glGenRenderbuffers = (PFNGLGENRENDERBUFFERSPROC)wglGetProcAddress("glGenRenderbuffers");
|
||||
glDeleteRenderbuffers = (PFNGLDELETERENDERBUFFERSPROC)wglGetProcAddress("glDeleteRenderbuffers");
|
||||
glBindRenderbuffer = (PFNGLBINDRENDERBUFFERPROC)wglGetProcAddress("glBindRenderbuffer");
|
||||
glRenderbufferStorage = (PFNGLRENDERBUFFERSTORAGEPROC)wglGetProcAddress("glRenderbufferStorage");
|
||||
glFramebufferRenderbuffer = (PFNGLFRAMEBUFFERRENDERBUFFERPROC)wglGetProcAddress("glFramebufferRenderbuffer");
|
||||
|
||||
gl.flags|=RFL_FRAMEBUFFER;
|
||||
}
|
||||
|
@ -310,16 +311,16 @@ void gl_LoadExtensions()
|
|||
CheckExtension("GL_ARB_texture_rg") &&
|
||||
gl.shadermodel == 4)
|
||||
{
|
||||
gl.TexBufferARB = (PFNGLTEXBUFFERARBPROC)wglGetProcAddress("glTexBufferARB");
|
||||
glTexBufferARB = (PFNGLTEXBUFFERARBPROC)wglGetProcAddress("glTexBufferARB");
|
||||
gl.flags|=RFL_TEXTUREBUFFER;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
gl.ActiveTexture = (PFNGLACTIVETEXTUREPROC)wglGetProcAddress("glActiveTextureARB");
|
||||
gl.MultiTexCoord2f = (PFNGLMULTITEXCOORD2FPROC) wglGetProcAddress("glMultiTexCoord2fARB");
|
||||
gl.MultiTexCoord2fv = (PFNGLMULTITEXCOORD2FVPROC) wglGetProcAddress("glMultiTexCoord2fvARB");
|
||||
glActiveTexture = (PFNGLACTIVETEXTUREPROC)wglGetProcAddress("glActiveTextureARB");
|
||||
glMultiTexCoord2f = (PFNGLMULTITEXCOORD2FPROC) wglGetProcAddress("glMultiTexCoord2fARB");
|
||||
glMultiTexCoord2fv = (PFNGLMULTITEXCOORD2FVPROC) wglGetProcAddress("glMultiTexCoord2fvARB");
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -1,22 +1,7 @@
|
|||
#ifndef R_RENDER
|
||||
#define R_RENDER
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#define APIENTRY
|
||||
#define APIENTRYP *
|
||||
#endif // __APPLE__
|
||||
|
||||
#include "basictypes.h"
|
||||
#ifndef _WIN32
|
||||
typedef bool BOOL;
|
||||
#endif
|
||||
|
||||
#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
|
||||
{
|
||||
|
@ -65,98 +50,9 @@ struct RenderContext
|
|||
{
|
||||
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;
|
||||
};
|
||||
|
||||
extern RenderContext gl;
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "c_dispatch.h"
|
||||
#include "v_video.h"
|
||||
#include "version.h"
|
||||
#include "gl/system/gl_interface.h"
|
||||
#include "gl/system/gl_cvars.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "menu/menu.h"
|
||||
|
|
|
@ -74,6 +74,7 @@
|
|||
#include <GL/glu.h>
|
||||
#include <GL/glext.h>
|
||||
#endif // __APPLE__
|
||||
#include "gl/api/gl_api.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#define DWORD WINDOWS_DWORD // I don't want to depend on this throughout the GL code!
|
||||
|
@ -92,9 +93,7 @@ inline T max( T a, T b) { return (((a)>(b)) ? (a) : (b)); }
|
|||
#ifndef _WIN32
|
||||
#include <SDL.h>
|
||||
#endif
|
||||
#include "gl/system/gl_interface.h"
|
||||
|
||||
extern RenderContext gl;
|
||||
|
||||
#ifdef LoadMenu
|
||||
#undef LoadMenu
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
#include "templates.h"
|
||||
#include "vectors.h"
|
||||
|
||||
#include "gl/system/gl_interface.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/renderer/gl_renderstate.h"
|
||||
#include "gl/system/gl_framebuffer.h"
|
||||
|
@ -506,7 +507,7 @@ bool OpenGLFrameBuffer::Wiper_Burn::Run(int ticks, OpenGLFrameBuffer *fb)
|
|||
|
||||
gl_RenderState.SetTextureMode(TM_MODULATE);
|
||||
gl_RenderState.Apply(true);
|
||||
gl.ActiveTexture(GL_TEXTURE1);
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
// mask out the alpha channel of the wipeendscreen.
|
||||
|
@ -518,7 +519,7 @@ bool OpenGLFrameBuffer::Wiper_Burn::Run(int ticks, OpenGLFrameBuffer *fb)
|
|||
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_PREVIOUS);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
|
||||
|
||||
gl.ActiveTexture(GL_TEXTURE0);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
|
||||
// Burn the new screen on top of it.
|
||||
glColor4f(1.f, 1.f, 1.f, 1.f);
|
||||
|
@ -533,24 +534,24 @@ bool OpenGLFrameBuffer::Wiper_Burn::Run(int ticks, OpenGLFrameBuffer *fb)
|
|||
|
||||
|
||||
glBegin(GL_TRIANGLE_STRIP);
|
||||
gl.MultiTexCoord2f(GL_TEXTURE0, 0, 0);
|
||||
gl.MultiTexCoord2f(GL_TEXTURE1, 0, vb);
|
||||
glMultiTexCoord2f(GL_TEXTURE0, 0, 0);
|
||||
glMultiTexCoord2f(GL_TEXTURE1, 0, vb);
|
||||
glVertex2i(0, 0);
|
||||
gl.MultiTexCoord2f(GL_TEXTURE0, 0, 1);
|
||||
gl.MultiTexCoord2f(GL_TEXTURE1, 0, 0);
|
||||
glMultiTexCoord2f(GL_TEXTURE0, 0, 1);
|
||||
glMultiTexCoord2f(GL_TEXTURE1, 0, 0);
|
||||
glVertex2i(0, fb->Height);
|
||||
gl.MultiTexCoord2f(GL_TEXTURE0, 1, 0);
|
||||
gl.MultiTexCoord2f(GL_TEXTURE1, ur, vb);
|
||||
glMultiTexCoord2f(GL_TEXTURE0, 1, 0);
|
||||
glMultiTexCoord2f(GL_TEXTURE1, ur, vb);
|
||||
glVertex2i(fb->Width, 0);
|
||||
gl.MultiTexCoord2f(GL_TEXTURE0, 1, 1);
|
||||
gl.MultiTexCoord2f(GL_TEXTURE1, ur, 0);
|
||||
glMultiTexCoord2f(GL_TEXTURE0, 1, 1);
|
||||
glMultiTexCoord2f(GL_TEXTURE1, ur, 0);
|
||||
glVertex2i(fb->Width, fb->Height);
|
||||
glEnd();
|
||||
|
||||
gl.ActiveTexture(GL_TEXTURE1);
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
gl.ActiveTexture(GL_TEXTURE0);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
|
||||
// The fire may not always stabilize, so the wipe is forced to end
|
||||
// after an arbitrary maximum time.
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
*/
|
||||
|
||||
#include "gl/system/gl_system.h"
|
||||
#include "gl/system/gl_interface.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/textures/gl_texture.h"
|
||||
#include "c_cvars.h"
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include "c_dispatch.h"
|
||||
#include "v_palette.h"
|
||||
|
||||
#include "gl/system/gl_interface.h"
|
||||
#include "gl/system/gl_cvars.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/textures/gl_material.h"
|
||||
|
@ -266,7 +267,7 @@ void FHardwareTexture::Clean(bool all)
|
|||
DeleteTexture(glTexID_Translated[i].glTexID);
|
||||
}
|
||||
glTexID_Translated.Clear();
|
||||
if (glDepthID != 0) gl.DeleteRenderbuffers(1, &glDepthID);
|
||||
if (glDepthID != 0) glDeleteRenderbuffers(1, &glDepthID);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
@ -327,9 +328,9 @@ unsigned int FHardwareTexture::Bind(int texunit, int cm,int translation)
|
|||
{
|
||||
if (lastbound[texunit]==*pTexID) return *pTexID;
|
||||
lastbound[texunit]=*pTexID;
|
||||
if (texunit != 0) gl.ActiveTexture(GL_TEXTURE0+texunit);
|
||||
if (texunit != 0) glActiveTexture(GL_TEXTURE0+texunit);
|
||||
glBindTexture(GL_TEXTURE_2D, *pTexID);
|
||||
if (texunit != 0) gl.ActiveTexture(GL_TEXTURE0);
|
||||
if (texunit != 0) glActiveTexture(GL_TEXTURE0);
|
||||
return *pTexID;
|
||||
}
|
||||
return 0;
|
||||
|
@ -340,9 +341,9 @@ void FHardwareTexture::Unbind(int texunit)
|
|||
{
|
||||
if (lastbound[texunit] != 0)
|
||||
{
|
||||
if (texunit != 0) gl.ActiveTexture(GL_TEXTURE0+texunit);
|
||||
if (texunit != 0) glActiveTexture(GL_TEXTURE0+texunit);
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
if (texunit != 0) gl.ActiveTexture(GL_TEXTURE0);
|
||||
if (texunit != 0) glActiveTexture(GL_TEXTURE0);
|
||||
lastbound[texunit] = 0;
|
||||
}
|
||||
}
|
||||
|
@ -367,11 +368,11 @@ int FHardwareTexture::GetDepthBuffer()
|
|||
{
|
||||
if (glDepthID == 0)
|
||||
{
|
||||
gl.GenRenderbuffers(1, &glDepthID);
|
||||
gl.BindRenderbuffer(GL_RENDERBUFFER, glDepthID);
|
||||
gl.RenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8,
|
||||
glGenRenderbuffers(1, &glDepthID);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, glDepthID);
|
||||
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8,
|
||||
GetTexDimension(texwidth), GetTexDimension(texheight));
|
||||
gl.BindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||
}
|
||||
return glDepthID;
|
||||
}
|
||||
|
@ -389,8 +390,8 @@ void FHardwareTexture::BindToFrameBuffer()
|
|||
{
|
||||
if (gl.flags & RFL_FRAMEBUFFER)
|
||||
{
|
||||
gl.FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, glTexID[0], 0);
|
||||
gl.FramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, GetDepthBuffer());
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, glTexID[0], 0);
|
||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, GetDepthBuffer());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -407,9 +408,9 @@ unsigned int FHardwareTexture::CreateTexture(unsigned char * buffer, int w, int
|
|||
|
||||
unsigned int * pTexID=GetTexID(cm, translation);
|
||||
|
||||
if (texunit != 0) gl.ActiveTexture(GL_TEXTURE0+texunit);
|
||||
if (texunit != 0) glActiveTexture(GL_TEXTURE0+texunit);
|
||||
LoadImage(buffer, w, h, *pTexID, wrap? GL_REPEAT:GL_CLAMP, cm==CM_SHADE, texunit);
|
||||
if (texunit != 0) gl.ActiveTexture(GL_TEXTURE0);
|
||||
if (texunit != 0) glActiveTexture(GL_TEXTURE0);
|
||||
return *pTexID;
|
||||
}
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
|
||||
//#include "gl/gl_intern.h"
|
||||
|
||||
#include "gl/system/gl_interface.h"
|
||||
#include "gl/system/gl_framebuffer.h"
|
||||
#include "gl/renderer/gl_lightdata.h"
|
||||
#include "gl/data/gl_data.h"
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
#include "v_palette.h"
|
||||
#include "sc_man.h"
|
||||
|
||||
#include "gl/system/gl_interface.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/textures/gl_texture.h"
|
||||
#include "gl/textures/gl_material.h"
|
||||
|
|
Loading…
Reference in a new issue