diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-02-25 22:09:39 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-02-25 22:09:39 +0400 |
commit | 79f9964cdb99d44dc41785d37a9712ad97b51d4d (patch) | |
tree | fad96a833511fcfc592eb4b3784f0d743a73d8d6 | |
parent | 3fc2fbc333e47c2bbc3cabd33a2cd6ada3c714fd (diff) |
Changes in double side lighting usage
Disabled double-side lighting by default and changed areas which are using
double sided lighting to switch it off just after doing stuff which requires
double side.
This makes code a bit more simple to follow (no all that disabling double side
lighting all over the code and so).
This change also fixes crash of blender caused by intel gme965 driver which
leads to stack corruption in some place when double side lighting isn't
disabled (probably driver still kind of using double side in some areas or so).
Hopefully it'll also fix #30293: Converting Text to Mesh
Thanks to Campbell to assist writing this patch!
-rw-r--r-- | source/blender/editors/space_view3d/drawobject.c | 8 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_extensions.c | 4 |
2 files changed, 7 insertions, 5 deletions
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 1c666e7eda5..2abfb9bac98 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -3021,6 +3021,7 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, glFrontFace(GL_CCW); glDisable(GL_LIGHTING); + glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0); } // Setup for drawing wire over, disable zbuffer @@ -3365,6 +3366,8 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D glFrontFace(GL_CCW); glDisable(GL_LIGHTING); + glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0); + if (base->flag & SELECT) { UI_ThemeColor(is_obact ? TH_ACTIVE : TH_SELECT); } @@ -3804,7 +3807,6 @@ static int drawCurveDerivedMesh(Scene *scene, View3D *v3d, RegionView3D *rv3d, B GPU_begin_object_materials(v3d, rv3d, scene, ob, glsl, NULL); if (!glsl) { - glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0); glEnable(GL_LIGHTING); dm->drawFacesSolid(dm, NULL, 0, GPU_enable_material); glDisable(GL_LIGHTING); @@ -3866,7 +3868,6 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas } else { GPU_begin_object_materials(v3d, rv3d, scene, ob, 0, NULL); - glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0); drawDispListsolid(lb, ob, 0); GPU_end_object_materials(); } @@ -3904,7 +3905,6 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas } else { GPU_begin_object_materials(v3d, rv3d, scene, ob, 0, NULL); - glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0); drawDispListsolid(lb, ob, 0); GPU_end_object_materials(); } @@ -3929,7 +3929,6 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas } else { GPU_begin_object_materials(v3d, rv3d, scene, ob, 0, NULL); - glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0); drawDispListsolid(lb, ob, 0); GPU_end_object_materials(); } @@ -7329,7 +7328,6 @@ static void draw_object_mesh_instance(Scene *scene, View3D *v3d, RegionView3D *r glDisable(GL_COLOR_MATERIAL); } - glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0); glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW); glEnable(GL_LIGHTING); diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c index a3e3eb19a5b..002563ada4b 100644 --- a/source/blender/gpu/intern/gpu_extensions.c +++ b/source/blender/gpu/intern/gpu_extensions.c @@ -179,6 +179,10 @@ void GPU_extensions_init(void) GG.npotdisabled = 1; } + /* make sure double side isn't used by defautl and only getting enabled in places where it's + * really needed to prevent different unexpected behaviors like with intel gme965 card (sergey) */ + glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0); + GG.os = GPU_OS_UNIX; #ifdef _WIN32 GG.os = GPU_OS_WIN; |