diff options
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r-- | source/blender/windowmanager/WM_types.h | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_draw.c | 51 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 4 |
3 files changed, 28 insertions, 29 deletions
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h index 0fe3e8a0fcf..ce4a69a1841 100644 --- a/source/blender/windowmanager/WM_types.h +++ b/source/blender/windowmanager/WM_types.h @@ -298,7 +298,7 @@ typedef struct wmNotifier { #define ND_MODIFIER (24<<16) #define ND_KEYS (25<<16) #define ND_CONSTRAINT (26<<16) -#define ND_PARTICLE (27<<16) +/*#define ND_PARTICLE (27<<16)*/ /* DEPRECATED */ #define ND_POINTCACHE (28<<16) #define ND_PARENT (29<<16) #define ND_LOD (30<<16) diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c index 3825db14e93..4303ce30d9e 100644 --- a/source/blender/windowmanager/intern/wm_draw.c +++ b/source/blender/windowmanager/intern/wm_draw.c @@ -59,6 +59,7 @@ #include "GPU_extensions.h" #include "GPU_glew.h" #include "GPU_basic_shader.h" +#include "GPU_immediate.h" #include "RE_engine.h" @@ -376,7 +377,7 @@ static void wm_draw_triple_fail(bContext *C, wmWindow *win) wm_method_draw_overlap_all(C, win, 0); } -static int wm_triple_gen_textures(wmWindow *win, wmDrawTriple *triple) +static bool wm_triple_gen_textures(wmWindow *win, wmDrawTriple *triple) { const int winsize_x = WM_window_pixels_x(win); const int winsize_y = WM_window_pixels_y(win); @@ -400,7 +401,7 @@ static int wm_triple_gen_textures(wmWindow *win, wmDrawTriple *triple) if (!triple->bind) { /* not the typical failure case but we handle it anyway */ printf("WM: failed to allocate texture for triple buffer drawing (glGenTextures).\n"); - return 0; + return false; } /* proxy texture is only guaranteed to test for the cases that @@ -411,7 +412,7 @@ static int wm_triple_gen_textures(wmWindow *win, wmDrawTriple *triple) glBindTexture(triple->target, 0); printf("WM: failed to allocate texture for triple buffer drawing " "(texture too large for graphics card).\n"); - return 0; + return false; } /* setup actual texture */ @@ -421,13 +422,7 @@ static int wm_triple_gen_textures(wmWindow *win, wmDrawTriple *triple) glTexParameteri(triple->target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glBindTexture(triple->target, 0); - /* not sure if this works everywhere .. */ - if (glGetError() == GL_OUT_OF_MEMORY) { - printf("WM: failed to allocate texture for triple buffer drawing (out of memory).\n"); - return 0; - } - - return 1; + return true; } void wm_triple_draw_textures(wmWindow *win, wmDrawTriple *triple, float alpha) @@ -451,28 +446,36 @@ void wm_triple_draw_textures(wmWindow *win, wmDrawTriple *triple, float alpha) halfy /= triple->y; } - GPU_basic_shader_bind((triple->target == GL_TEXTURE_2D) ? GPU_SHADER_TEXTURE_2D : GPU_SHADER_TEXTURE_RECT); + 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); glBindTexture(triple->target, triple->bind); - glColor4f(1.0f, 1.0f, 1.0f, alpha); - glBegin(GL_QUADS); - glTexCoord2f(halfx, halfy); - glVertex2f(0, 0); + immUniform1i("texture_map", 0); - glTexCoord2f(ratiox + halfx, halfy); - glVertex2f(sizex, 0); + immBegin(GL_QUADS, 4); - glTexCoord2f(ratiox + halfx, ratioy + halfy); - glVertex2f(sizex, sizey); + immAttrib2f(texcoord, halfx, halfy); + immVertex2f(pos, 0.0f, 0.0f); - glTexCoord2f(halfx, ratioy + halfy); - glVertex2f(0, sizey); - glEnd(); + immAttrib2f(texcoord, ratiox + halfx, halfy); + immVertex2f(pos, sizex, 0.0f); - glBindTexture(triple->target, 0); + immAttrib2f(texcoord, ratiox + halfx, ratioy + halfy); + immVertex2f(pos, sizex, sizey); - GPU_basic_shader_bind(GPU_SHADER_USE_COLOR); + immAttrib2f(texcoord, halfx, ratioy + halfy); + immVertex2f(pos, 0.0f, sizey); + + immEnd(); + 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_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index dc34e8015c9..7625f55be6e 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -68,8 +68,6 @@ #include "RNA_access.h" -#include "GPU_debug.h" - #include "UI_interface.h" #include "PIL_time.h" @@ -2534,8 +2532,6 @@ void wm_event_do_handlers(bContext *C) /* update key configuration after handling events */ WM_keyconfig_update(wm); - - GPU_ASSERT_NO_GL_ERRORS("wm_event_do_handlers"); } /* ********** filesector handling ************ */ |