Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/gpu/intern/gpu_draw.c')
-rw-r--r--source/blender/gpu/intern/gpu_draw.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index 6f69a2b8a31..7f5f85e23a6 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -167,6 +167,8 @@ static int smaller_pow2(int num)
static int is_pow2_limit(int num)
{
/* take texture clamping into account */
+ if (G.f & G_TEXTUREPAINT)
+ return 1;
if (U.glreslimit != 0 && num > U.glreslimit)
return 0;
@@ -175,6 +177,9 @@ static int is_pow2_limit(int num)
static int smaller_pow2_limit(int num)
{
+ if (G.f & G_TEXTUREPAINT)
+ return 1;
+
/* take texture clamping into account */
if (U.glreslimit != 0 && num > U.glreslimit)
return U.glreslimit;
@@ -999,6 +1004,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);
@@ -1036,7 +1043,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;
@@ -1047,6 +1054,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) {
@@ -1133,9 +1144,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);