Fixed bug that caused transparent objects to intermittently become opaque

--HG--
extra : convert_revision : svn%3A7752d6cf-9f14-4ad2-affc-04f1e67b81a5/trunk%40141
This commit is contained in:
kearwood
2012-10-25 18:48:25 +00:00
parent 15ebea1533
commit 17ce0fd05a
2 changed files with 10 additions and 5 deletions

View File

@@ -33,8 +33,7 @@ public:
RENDER_PASS_DEFERRED_OPAQUE,
RENDER_PASS_FORWARD_TRANSPARENT,
RENDER_PASS_FLARES,
RENDER_PASS_SHADOWMAP,
RENDER_PASS_SKYBOX
RENDER_PASS_SHADOWMAP
};
KRNode(KRScene &scene, std::string name);

View File

@@ -236,7 +236,9 @@ void KRScene::render(int childOrder[], KROctreeNode *pOctreeNode, std::set<KRAAB
KRMat4 mvpmatrix = matModel * viewMatrix * projectionMatrix;
// Enable additive blending
GLDEBUG(glEnable(GL_BLEND));
if(renderPass != KRNode::RENDER_PASS_FORWARD_TRANSPARENT) {
GLDEBUG(glEnable(GL_BLEND));
}
GLDEBUG(glBlendFunc(GL_ONE, GL_ONE));
@@ -262,10 +264,14 @@ void KRScene::render(int childOrder[], KROctreeNode *pOctreeNode, std::set<KRAAB
GLDEBUG(glDepthMask(GL_TRUE));
}
GLDEBUG(glDisable(GL_BLEND));
pOctreeNode->endOcclusionQuery();
if(renderPass != KRNode::RENDER_PASS_FORWARD_TRANSPARENT) {
GLDEBUG(glDisable(GL_BLEND));
} else {
GLDEBUG(glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA));
}
if(bVisible) {
// Schedule a pass to get the result of the occlusion test only for future frames and passes, without rendering the model or recurring further