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:
-rw-r--r--source/blender/gpu/gawain/immediate.c11
-rw-r--r--source/blender/gpu/gawain/immediate.h1
-rw-r--r--source/blender/gpu/shaders/gpu_shader_2D_texture_2D_frag.glsl3
-rw-r--r--source/blender/gpu/shaders/gpu_shader_2D_texture_rect_frag.glsl3
-rw-r--r--source/blender/windowmanager/intern/wm_draw.c1
-rw-r--r--source/blender/windowmanager/intern/wm_stereo.c1
6 files changed, 18 insertions, 2 deletions
diff --git a/source/blender/gpu/gawain/immediate.c b/source/blender/gpu/gawain/immediate.c
index 9c3904f21cb..7edc4e2caaf 100644
--- a/source/blender/gpu/gawain/immediate.c
+++ b/source/blender/gpu/gawain/immediate.c
@@ -622,6 +622,17 @@ void immVertex3fv(unsigned attrib_id, const float data[3])
immEndVertex();
}
+void immUniform1f(const char* name, float x)
+{
+ int loc = glGetUniformLocation(imm.bound_program, name);
+
+#if TRUST_NO_ONE
+ assert(loc != -1);
+#endif
+
+ glUniform1f(loc, x);
+}
+
void immUniform4f(const char* name, float x, float y, float z, float w)
{
int loc = glGetUniformLocation(imm.bound_program, name);
diff --git a/source/blender/gpu/gawain/immediate.h b/source/blender/gpu/gawain/immediate.h
index 84fb0760e2e..3fcf85607c3 100644
--- a/source/blender/gpu/gawain/immediate.h
+++ b/source/blender/gpu/gawain/immediate.h
@@ -66,6 +66,7 @@ void immVertex3fv(unsigned attrib_id, const float data[3]);
void immVertex2iv(unsigned attrib_id, const int data[2]);
// provide values that don't change for the entire draw call
+void immUniform1f(const char* name, float x);
void immUniform4f(const char* name, float x, float y, float z, float w);
// these set "uniform vec4 color"
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_texture_2D_frag.glsl b/source/blender/gpu/shaders/gpu_shader_2D_texture_2D_frag.glsl
index 6029fd89f64..69bc616db22 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_texture_2D_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_texture_2D_frag.glsl
@@ -6,9 +6,10 @@
out vec4 fragColor;
#endif
+uniform float alpha;
uniform sampler2D texture_map;
void main()
{
- fragColor = texture2D(texture_map, texture_coord);
+ fragColor = vec4(texture2D(texture_map, texture_coord).rgb, alpha);
}
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_texture_rect_frag.glsl b/source/blender/gpu/shaders/gpu_shader_2D_texture_rect_frag.glsl
index d32b8bac3b8..75298bcb5c5 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_texture_rect_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_texture_rect_frag.glsl
@@ -6,9 +6,10 @@
out vec4 fragColor;
#endif
+uniform float alpha;
uniform sampler2DRect texture_map;
void main()
{
- fragColor = texture2DRect(texture_map, texture_coord);
+ fragColor = vec4(texture2DRect(texture_map, texture_coord).rgb, alpha);
}
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c
index 4303ce30d9e..e9eaa5677e4 100644
--- a/source/blender/windowmanager/intern/wm_draw.c
+++ b/source/blender/windowmanager/intern/wm_draw.c
@@ -455,6 +455,7 @@ void wm_triple_draw_textures(wmWindow *win, wmDrawTriple *triple, float alpha)
glBindTexture(triple->target, triple->bind);
+ immUniform1f("alpha", alpha);
immUniform1i("texture_map", 0);
immBegin(GL_QUADS, 4);
diff --git a/source/blender/windowmanager/intern/wm_stereo.c b/source/blender/windowmanager/intern/wm_stereo.c
index ea9a09d1a34..e2b6df65ce8 100644
--- a/source/blender/windowmanager/intern/wm_stereo.c
+++ b/source/blender/windowmanager/intern/wm_stereo.c
@@ -282,6 +282,7 @@ static void wm_method_draw_stereo3d_topbottom(wmWindow *win)
glBindTexture(triple->target, triple->bind);
+ immUniform1f("alpha", 1.0f);
immUniform1i("texture_map", 0);
immBegin(GL_QUADS, 4);