diff --git a/src/gl/scene/gl_walls.cpp b/src/gl/scene/gl_walls.cpp index d9eb74354e..2e4e21e5cf 100644 --- a/src/gl/scene/gl_walls.cpp +++ b/src/gl/scene/gl_walls.cpp @@ -242,7 +242,7 @@ void GLWall::SplitWall(sector_t * frontsector, bool translucent) for (unsigned i = 0; i < lightlist.Size(); i++) { lights[i].cliptop = &lightlist[i].plane; - lights[i].clipbottom = i == lightlist.Size() - 1 ? &bottomplane : &lightlist[i + 1].plane; + lights[i].clipbottom = i == lightlist.Size() - 1 ? (secplane_t*)NULL : &lightlist[i + 1].plane; lights[i].lightlevel = lightlist[i].caster != NULL? gl_ClampLight(*lightlist[i].p_lightlevel) : lightlevel; lights[i].colormap.FadeColor = Colormap.FadeColor; lights[i].colormap.CopyFrom3DLight(&lightlist[i]); diff --git a/src/gl/scene/gl_walls_draw.cpp b/src/gl/scene/gl_walls_draw.cpp index 90eddd2e97..4bff69238f 100644 --- a/src/gl/scene/gl_walls_draw.cpp +++ b/src/gl/scene/gl_walls_draw.cpp @@ -338,17 +338,18 @@ void GLWall::RenderTextured(int rflags) } else { - unsigned int store[2]; - //RenderWall(rflags, store); gl_RenderState.EnableSplit(true); - for (unsigned i = 0; i < lightsize; i++) + glEnable(GL_CLIP_DISTANCE3); + glEnable(GL_CLIP_DISTANCE4); + for (unsigned i = 0; i mVBO->RenderArray(GL_TRIANGLE_FAN, store[0], store[1]); + gl_RenderState.SetSplitPlanes(*lights[i].cliptop, lights[i].clipbottom? *lights[i].clipbottom : bottomplane); RenderWall(rflags); } + glDisable(GL_CLIP_DISTANCE3); + glDisable(GL_CLIP_DISTANCE4); gl_RenderState.EnableSplit(false); } gl_RenderState.SetTextureMode(tmode);