diff options
Diffstat (limited to 'source/blender/gpu/intern/gpu_draw.c')
-rw-r--r-- | source/blender/gpu/intern/gpu_draw.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index 4025a12a867..84bed5ccdbd 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -993,6 +993,8 @@ int GPU_default_lights(void) U.light[2].spec[3]= 1.0; } + glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_FALSE); + glLightfv(GL_LIGHT0, GL_POSITION, U.light[0].vec); glLightfv(GL_LIGHT0, GL_DIFFUSE, U.light[0].col); glLightfv(GL_LIGHT0, GL_SPECULAR, U.light[0].spec); @@ -1030,7 +1032,7 @@ int GPU_default_lights(void) return count; } -int GPU_scene_object_lights(Scene *scene, Object *ob, int lay, float viewmat[][4]) +int GPU_scene_object_lights(Scene *scene, Object *ob, int lay, float viewmat[][4], int ortho) { Base *base; Lamp *la; @@ -1041,6 +1043,10 @@ int GPU_scene_object_lights(Scene *scene, Object *ob, int lay, float viewmat[][4 for(count=0; count<8; count++) glDisable(GL_LIGHT0+count); + /* view direction for specular is not compute correct by default in + * opengl, so we set the settings ourselfs */ + glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, (ortho)? GL_FALSE: GL_TRUE); + count= 0; for(base=scene->base.first; base; base=base->next) { @@ -1127,9 +1133,6 @@ void GPU_state_init(void) GPU_default_lights(); - /* no local viewer, looks ugly in ortho mode */ - /* glLightModelfv(GL_LIGHT_MODEL_LOCAL_VIEWER, &one); */ - glDepthFunc(GL_LEQUAL); /* scaling matrices */ glEnable(GL_NORMALIZE); |