diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-04-11 17:30:00 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-04-11 17:49:39 +0300 |
commit | 5a4fceff1b10e18fffc1d536e71e47b27ed40402 (patch) | |
tree | ee2ca5fdba07e562a0977be8c2de3a21a0994f3f /source/blender/editors/include/BIF_glutil.h | |
parent | 35ee9db1e2432c9c6346eb450073d609fa07dc1e (diff) |
Make image drawing code working with core profile
The issue was caused here by usage of deprecated GL_CURRENT_PROGRAM
which was returning rubbish value.
Now we use imm API and create vertex format prior to immBindProgram.
This made us required to have some sort of state passed from setup
function to actual drawing.
Diffstat (limited to 'source/blender/editors/include/BIF_glutil.h')
-rw-r--r-- | source/blender/editors/include/BIF_glutil.h | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/source/blender/editors/include/BIF_glutil.h b/source/blender/editors/include/BIF_glutil.h index 0d90dab1f1e..1477d20f7f1 100644 --- a/source/blender/editors/include/BIF_glutil.h +++ b/source/blender/editors/include/BIF_glutil.h @@ -67,10 +67,16 @@ int glaGetOneInt(int param); */ void glaRasterPosSafe2f(float x, float y, float known_good_x, float known_good_y); +typedef struct IMMDrawPixelsTexState { + struct GPUShader *shader; + unsigned int pos; + unsigned int texco; +} IMMDrawPixelsTexState; + /* To be used before calling immDrawPixelsTex * Default shader is GPU_SHADER_2D_IMAGE_COLOR * Returns a shader to be able to set uniforms */ -struct GPUShader *immDrawPixelsTexSetup(int builtin); +IMMDrawPixelsTexState immDrawPixelsTexSetup(int builtin); /** * immDrawPixelsTex - Functions like a limited glDrawPixels, but actually draws the @@ -86,14 +92,18 @@ struct GPUShader *immDrawPixelsTexSetup(int builtin); * modelview and projection matrices are assumed to define a * 1-to-1 mapping to screen space. */ -void immDrawPixelsTex(float x, float y, int img_w, int img_h, int format, int type, int zoomfilter, void *rect, +void immDrawPixelsTex(IMMDrawPixelsTexState *state, + float x, float y, int img_w, int img_h, int format, int type, int zoomfilter, void *rect, float xzoom, float yzoom, float color[4]); -void immDrawPixelsTex_clipping(float x, float y, int img_w, int img_h, int format, int type, int zoomfilter, void *rect, +void immDrawPixelsTex_clipping(IMMDrawPixelsTexState *state, + float x, float y, int img_w, int img_h, int format, int type, int zoomfilter, void *rect, float clip_min_x, float clip_min_y, float clip_max_x, float clip_max_y, float xzoom, float yzoom, float color[4]); -void immDrawPixelsTexScaled(float x, float y, int img_w, int img_h, int format, int type, int zoomfilter, void *rect, float scaleX, float scaleY, - float xzoom, float yzoom, float color[4]); -void immDrawPixelsTexScaled_clipping(float x, float y, int img_w, int img_h, int format, int type, int zoomfilter, void *rect, float scaleX, float scaleY, +void immDrawPixelsTexScaled(IMMDrawPixelsTexState *state, + float x, float y, int img_w, int img_h, int format, int type, int zoomfilter, void *rect, float scaleX, float scaleY, + float xzoom, float yzoom, float color[4]); +void immDrawPixelsTexScaled_clipping(IMMDrawPixelsTexState *state, + float x, float y, int img_w, int img_h, int format, int type, int zoomfilter, void *rect, float scaleX, float scaleY, float clip_min_x, float clip_min_y, float clip_max_x, float clip_max_y, float xzoom, float yzoom, float color[4]); /* 2D Drawing Assistance */ |