- 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

@ -233,7 +233,20 @@ public:
void EnableSplit(bool on)
{
mSplitEnabled = on;
if (gl.glslversion >= 1.3f)
{
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)

View file

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

View file

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

View file

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

View file

@ -339,8 +339,6 @@ void GLWall::RenderTextured(int rflags)
else
{
gl_RenderState.EnableSplit(true);
glEnable(GL_CLIP_DISTANCE3);
glEnable(GL_CLIP_DISTANCE4);
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;
}
glDisable(GL_CLIP_DISTANCE3);
glDisable(GL_CLIP_DISTANCE4);
gl_RenderState.EnableSplit(false);
}
gl_RenderState.SetTextureMode(tmode);