diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2013-12-18 20:24:52 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2013-12-18 20:24:52 +0400 |
commit | 355c699dc6b6e95ef9305100a62efa7e70ae93ec (patch) | |
tree | 502f7fd56f86ec0a4c08f10850075ddd361e831d /source/blender | |
parent | 9943802829132fbcdc207e1d69b9bf5326a8255c (diff) |
Fix T37834: smoke opengl render not delivering correct alpha channel.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/space_view3d/drawvolume.c | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c index 8fc12e836f1..6ee1df4e131 100644 --- a/source/blender/editors/space_view3d/drawvolume.c +++ b/source/blender/editors/space_view3d/drawvolume.c @@ -132,6 +132,8 @@ void draw_smoke_volume(SmokeDomainSettings *sds, Object *ob, float cor[3] = {1.0f, 1.0f, 1.0f}; int gl_depth = 0, gl_blend = 0; + int use_fire = (sds->active_fields & SM_ACTIVE_FIRE); + /* draw slices of smoke is adapted from c++ code authored * by: Johannes Schmid and Ingemar Rask, 2006, johnny@grob.org */ float cv[][3] = { @@ -460,22 +462,32 @@ void draw_smoke_volume(SmokeDomainSettings *sds, Object *ob, } /* render fire slice */ - glBlendFunc(GL_SRC_ALPHA, GL_ONE); - glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 2, 1.0, 0.0, 0.0, 0.0); - glBegin(GL_POLYGON); - glColor3f(1.0, 1.0, 1.0); - for (i = 0; i < numpoints; i++) { - glTexCoord3d((points[i][0] - min[0]) * cor[0], - (points[i][1] - min[1]) * cor[1], - (points[i][2] - min[2]) * cor[2]); - glVertex3f(points[i][0] * ob_sizei[0], - points[i][1] * ob_sizei[1], - points[i][2] * ob_sizei[2]); + if (use_fire) { + if (GLEW_VERSION_1_4) + glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE, GL_ONE, GL_ONE); + else + glBlendFunc(GL_SRC_ALPHA, GL_ONE); + + glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 2, 1.0, 0.0, 0.0, 0.0); + glBegin(GL_POLYGON); + glColor3f(1.0, 1.0, 1.0); + for (i = 0; i < numpoints; i++) { + glTexCoord3d((points[i][0] - min[0]) * cor[0], + (points[i][1] - min[1]) * cor[1], + (points[i][2] - min[2]) * cor[2]); + glVertex3f(points[i][0] * ob_sizei[0], + points[i][1] * ob_sizei[1], + points[i][2] * ob_sizei[2]); + } + glEnd(); } - glEnd(); /* render smoke slice */ - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + if (GLEW_VERSION_1_4) + glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + else + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 2, -1.0, 0.0, 0.0, 0.0); glBegin(GL_POLYGON); glColor3f(1.0, 1.0, 1.0); |