- better be safe and not call GL_CLIP_DISTANCE functions on old hardware.

This commit is contained in:
Christoph Oelckers 2016-04-26 21:55:17 +02:00
parent 3faf5afa3a
commit 066d5c63e2
5 changed files with 24 additions and 17 deletions

View file

@ -232,8 +232,21 @@ public:
} }
void EnableSplit(bool on) void EnableSplit(bool on)
{
if (gl.glslversion >= 1.3f)
{ {
mSplitEnabled = on; mSplitEnabled = on;
if (on)
{
glEnable(GL_CLIP_DISTANCE3);
glEnable(GL_CLIP_DISTANCE4);
}
else
{
glDisable(GL_CLIP_DISTANCE3);
glDisable(GL_CLIP_DISTANCE4);
}
}
} }
void SetLightIndex(int n) void SetLightIndex(int n)

View file

@ -388,8 +388,6 @@ void GLWall::DoDrawDecals()
if (lightlist != NULL) if (lightlist != NULL)
{ {
gl_RenderState.EnableSplit(true); gl_RenderState.EnableSplit(true);
glEnable(GL_CLIP_DISTANCE3);
glEnable(GL_CLIP_DISTANCE4);
} }
else else
{ {
@ -405,8 +403,6 @@ void GLWall::DoDrawDecals()
if (lightlist != NULL) if (lightlist != NULL)
{ {
glDisable(GL_CLIP_DISTANCE3);
glDisable(GL_CLIP_DISTANCE4);
gl_RenderState.EnableSplit(false); gl_RenderState.EnableSplit(false);
} }

View file

@ -806,11 +806,17 @@ void GLDrawList::DrawSorted()
sorted=DoSort(SortNodes[SortNodeStart]); sorted=DoSort(SortNodes[SortNodeStart]);
} }
gl_RenderState.ClearClipSplit(); gl_RenderState.ClearClipSplit();
if (gl.glslversion >= 1.3f)
{
glEnable(GL_CLIP_DISTANCE1); glEnable(GL_CLIP_DISTANCE1);
glEnable(GL_CLIP_DISTANCE2); glEnable(GL_CLIP_DISTANCE2);
}
DoDrawSorted(sorted); DoDrawSorted(sorted);
if (gl.glslversion >= 1.3f)
{
glDisable(GL_CLIP_DISTANCE1); glDisable(GL_CLIP_DISTANCE1);
glDisable(GL_CLIP_DISTANCE2); glDisable(GL_CLIP_DISTANCE2);
}
gl_RenderState.ClearClipSplit(); gl_RenderState.ClearClipSplit();
} }

View file

@ -226,8 +226,6 @@ void GLSprite::Draw(int pass)
{ {
clipping = true; clipping = true;
gl_RenderState.EnableSplit(true); gl_RenderState.EnableSplit(true);
glEnable(GL_CLIP_DISTANCE3);
glEnable(GL_CLIP_DISTANCE4);
} }
secplane_t bottomp = { { 0, 0, -1. }, bottomclip }; secplane_t bottomp = { { 0, 0, -1. }, bottomclip };
@ -333,8 +331,6 @@ void GLSprite::Draw(int pass)
if (clipping) if (clipping)
{ {
glDisable(GL_CLIP_DISTANCE3);
glDisable(GL_CLIP_DISTANCE4);
gl_RenderState.EnableSplit(false); gl_RenderState.EnableSplit(false);
} }

View file

@ -339,8 +339,6 @@ void GLWall::RenderTextured(int rflags)
else else
{ {
gl_RenderState.EnableSplit(true); gl_RenderState.EnableSplit(true);
glEnable(GL_CLIP_DISTANCE3);
glEnable(GL_CLIP_DISTANCE4);
for (unsigned i = 0; i < lightlist->Size(); i++) for (unsigned i = 0; i < lightlist->Size(); i++)
{ {
@ -363,8 +361,6 @@ void GLWall::RenderTextured(int rflags)
if (low1 <= zbottom[0] && low2 <= zbottom[1]) break; if (low1 <= zbottom[0] && low2 <= zbottom[1]) break;
} }
glDisable(GL_CLIP_DISTANCE3);
glDisable(GL_CLIP_DISTANCE4);
gl_RenderState.EnableSplit(false); gl_RenderState.EnableSplit(false);
} }
gl_RenderState.SetTextureMode(tmode); gl_RenderState.SetTextureMode(tmode);