Skip to content

Commit 4380963

Browse files
committed
Merge pull request #754 from SCIInstitute/transparency-fix
Face transparency flip
2 parents 6156d05 + f328d08 commit 4380963

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

src/Interface/Modules/Render/ES/systems/RenderBasicSys.cc

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,12 +171,22 @@ class RenderBasicSys :
171171

172172
geom.front().attribs.bind();
173173

174+
bool depthMask = glIsEnabled(GL_DEPTH_WRITEMASK);
175+
bool cullFace = glIsEnabled(GL_CULL_FACE);
176+
bool blend = glIsEnabled(GL_BLEND);
177+
174178
// Disable zwrite if we are rendering a transparent object.
175179
if (srstate.front().state.get(RenderState::USE_TRANSPARENCY))
176180
{
177181
GL(glDepthMask(GL_FALSE));
178-
GL(glDisable(GL_CULL_FACE));
182+
//GL(glDisable(GL_CULL_FACE));
179183
}
184+
else
185+
{
186+
GL(glDepthMask(GL_TRUE));
187+
GL(glDisable(GL_CULL_FACE));
188+
GL(glDisable(GL_BLEND));
189+
}
180190

181191
if (rlist.size() > 0)
182192
{
@@ -296,6 +306,18 @@ class RenderBasicSys :
296306
GL(glDepthMask(GL_TRUE));
297307
GL(glEnable(GL_CULL_FACE));
298308
}
309+
else
310+
{
311+
GL(glDepthMask(depthMask));
312+
if (cullFace)
313+
{
314+
GL(glEnable(GL_CULL_FACE));
315+
}
316+
if (blend)
317+
{
318+
GL(glEnable(GL_BLEND));
319+
}
320+
}
299321

300322
geom.front().attribs.unbind();
301323

0 commit comments

Comments
 (0)