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/windowmanager')
-rw-r--r--source/blender/windowmanager/intern/wm_draw.c13
-rw-r--r--source/blender/windowmanager/intern/wm_stereo.c42
2 files changed, 30 insertions, 25 deletions
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c
index e9eaa5677e4..f38f1eee7ec 100644
--- a/source/blender/windowmanager/intern/wm_draw.c
+++ b/source/blender/windowmanager/intern/wm_draw.c
@@ -447,16 +447,16 @@ void wm_triple_draw_textures(wmWindow *win, wmDrawTriple *triple, float alpha)
}
VertexFormat *format = immVertexFormat();
- unsigned texcoord = add_attrib(format, "texcoord", GL_FLOAT, 2, KEEP_FLOAT);
- unsigned pos = add_attrib(format, "position", GL_FLOAT, 2, KEEP_FLOAT);
-
- glEnable(triple->target);
- immBindBuiltinProgram((triple->target == GL_TEXTURE_2D) ? GPU_SHADER_2D_TEXTURE_2D : GPU_SHADER_2D_TEXTURE_RECT);
+ unsigned texcoord = add_attrib(format, "texCoord", GL_FLOAT, 2, KEEP_FLOAT);
+ unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT);
+ const int activeTex = GL_TEXTURE0;
+ glActiveTexture(activeTex);
glBindTexture(triple->target, triple->bind);
+ immBindBuiltinProgram((triple->target == GL_TEXTURE_2D) ? GPU_SHADER_3D_IMAGE_MODULATE_ALPHA : GPU_SHADER_3D_IMAGE_RECT_MODULATE_ALPHA);
immUniform1f("alpha", alpha);
- immUniform1i("texture_map", 0);
+ immUniform1i("image", activeTex);
immBegin(GL_QUADS, 4);
@@ -476,7 +476,6 @@ void wm_triple_draw_textures(wmWindow *win, wmDrawTriple *triple, float alpha)
immUnbindProgram();
glBindTexture(triple->target, 0);
- glDisable(triple->target);
}
static void wm_triple_copy_textures(wmWindow *win, wmDrawTriple *triple)
diff --git a/source/blender/windowmanager/intern/wm_stereo.c b/source/blender/windowmanager/intern/wm_stereo.c
index e2b6df65ce8..c72bd676364 100644
--- a/source/blender/windowmanager/intern/wm_stereo.c
+++ b/source/blender/windowmanager/intern/wm_stereo.c
@@ -173,6 +173,13 @@ static void wm_method_draw_stereo3d_sidebyside(wmWindow *win)
int soffx;
bool cross_eyed = (win->stereo3d_format->flag & S3D_SIDEBYSIDE_CROSSEYED) != 0;
+ const int activeTex = GL_TEXTURE0;
+ glActiveTexture(activeTex);
+
+ VertexFormat *format = immVertexFormat();
+ unsigned texcoord = add_attrib(format, "texCoord", GL_FLOAT, 2, KEEP_FLOAT);
+ unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT);
+
for (view = 0; view < 2; view ++) {
drawdata = BLI_findlink(&win->drawdata, (view * 2) + 1);
triple = drawdata->triple;
@@ -204,16 +211,12 @@ static void wm_method_draw_stereo3d_sidebyside(wmWindow *win)
halfy /= triple->y;
}
- VertexFormat *format = immVertexFormat();
- unsigned texcoord = add_attrib(format, "texcoord", GL_FLOAT, 2, KEEP_FLOAT);
- unsigned pos = add_attrib(format, "position", GL_FLOAT, 2, KEEP_FLOAT);
-
- glEnable(triple->target);
- immBindBuiltinProgram((triple->target == GL_TEXTURE_2D) ? GPU_SHADER_2D_TEXTURE_2D : GPU_SHADER_2D_TEXTURE_RECT);
+ /* TODO: if target is always same for both eyes, bind program & set uniform before loop */
+ immBindBuiltinProgram((triple->target == GL_TEXTURE_2D) ? GPU_SHADER_3D_IMAGE_MODULATE_ALPHA : GPU_SHADER_3D_IMAGE_RECT_MODULATE_ALPHA);
glBindTexture(triple->target, triple->bind);
- immUniform1i("texture_map", 0);
+ immUniform1i("image", activeTex);
immBegin(GL_QUADS, 4);
@@ -230,10 +233,10 @@ static void wm_method_draw_stereo3d_sidebyside(wmWindow *win)
immVertex2f(pos, soffx, sizey);
immEnd();
- immUnbindProgram();
+ /* TODO: if target is always same for both eyes, unbind program & texture target after loop */
glBindTexture(triple->target, 0);
- glDisable(triple->target);
+ immUnbindProgram();
}
}
@@ -245,6 +248,13 @@ static void wm_method_draw_stereo3d_topbottom(wmWindow *win)
int view;
int soffy;
+ const int activeTex = GL_TEXTURE0;
+ glActiveTexture(activeTex);
+
+ VertexFormat *format = immVertexFormat();
+ unsigned texcoord = add_attrib(format, "texCoord", GL_FLOAT, 2, KEEP_FLOAT);
+ unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT);
+
for (view = 0; view < 2; view ++) {
drawdata = BLI_findlink(&win->drawdata, (view * 2) + 1);
triple = drawdata->triple;
@@ -273,17 +283,13 @@ static void wm_method_draw_stereo3d_topbottom(wmWindow *win)
halfy /= triple->y;
}
- VertexFormat *format = immVertexFormat();
- unsigned texcoord = add_attrib(format, "texcoord", GL_FLOAT, 2, KEEP_FLOAT);
- unsigned pos = add_attrib(format, "position", GL_FLOAT, 2, KEEP_FLOAT);
-
- glEnable(triple->target);
- immBindBuiltinProgram((triple->target == GL_TEXTURE_2D) ? GPU_SHADER_2D_TEXTURE_2D : GPU_SHADER_2D_TEXTURE_RECT);
+ /* TODO: if target is always same for both eyes, bind program & set uniforms before loop */
+ immBindBuiltinProgram((triple->target == GL_TEXTURE_2D) ? GPU_SHADER_3D_IMAGE_MODULATE_ALPHA : GPU_SHADER_3D_IMAGE_RECT_MODULATE_ALPHA);
glBindTexture(triple->target, triple->bind);
immUniform1f("alpha", 1.0f);
- immUniform1i("texture_map", 0);
+ immUniform1i("image", activeTex);
immBegin(GL_QUADS, 4);
@@ -300,10 +306,10 @@ static void wm_method_draw_stereo3d_topbottom(wmWindow *win)
immVertex2f(pos, 0.0f, soffy + (sizey * 0.5f));
immEnd();
- immUnbindProgram();
+ /* TODO: if target is always same for both eyes, unbind program & texture target after loop */
+ immUnbindProgram();
glBindTexture(triple->target, 0);
- glDisable(triple->target);
}
}