Blender  V3.3
Classes | Typedefs | Functions
BIF_glutil.h File Reference
#include "GPU_texture.h"

Go to the source code of this file.

Classes

struct  IMMDrawPixelsTexState
 

Typedefs

typedef struct IMMDrawPixelsTexState IMMDrawPixelsTexState
 

Functions

IMMDrawPixelsTexState immDrawPixelsTexSetup (int builtin)
 
void immDrawPixelsTexScaledFullSize (const IMMDrawPixelsTexState *state, float x, float y, int img_w, int img_h, eGPUTextureFormat gpu_format, bool use_filter, const void *rect, float scaleX, float scaleY, float xzoom, float yzoom, const float color[4])
 
void immDrawPixelsTexTiled (IMMDrawPixelsTexState *state, float x, float y, int img_w, int img_h, eGPUTextureFormat gpu_format, bool use_filter, void *rect, float xzoom, float yzoom, const float color[4])
 
void immDrawPixelsTexTiled_clipping (IMMDrawPixelsTexState *state, float x, float y, int img_w, int img_h, eGPUTextureFormat gpu_format, bool use_filter, void *rect, float clip_min_x, float clip_min_y, float clip_max_x, float clip_max_y, float xzoom, float yzoom, const float color[4])
 
void immDrawPixelsTexTiled_scaling (IMMDrawPixelsTexState *state, float x, float y, int img_w, int img_h, eGPUTextureFormat gpu_format, bool use_filter, void *rect, float scaleX, float scaleY, float xzoom, float yzoom, const float color[4])
 
void immDrawPixelsTexTiled_scaling_clipping (IMMDrawPixelsTexState *state, float x, float y, int img_w, int img_h, eGPUTextureFormat gpu_format, bool use_filter, 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, const float color[4])
 
void ED_draw_imbuf (struct ImBuf *ibuf, float x, float y, bool use_filter, struct ColorManagedViewSettings *view_settings, struct ColorManagedDisplaySettings *display_settings, float zoom_x, float zoom_y)
 
void ED_draw_imbuf_clipping (struct ImBuf *ibuf, float x, float y, bool use_filter, struct ColorManagedViewSettings *view_settings, struct ColorManagedDisplaySettings *display_settings, float clip_min_x, float clip_min_y, float clip_max_x, float clip_max_y, float zoom_x, float zoom_y)
 
void ED_draw_imbuf_ctx (const struct bContext *C, struct ImBuf *ibuf, float x, float y, bool use_filter, float zoom_x, float zoom_y)
 
void ED_draw_imbuf_ctx_clipping (const struct bContext *C, struct ImBuf *ibuf, float x, float y, bool use_filter, float clip_min_x, float clip_min_y, float clip_max_x, float clip_max_y, float zoom_x, float zoom_y)
 
int ED_draw_imbuf_method (struct ImBuf *ibuf)
 
void immDrawBorderCorners (unsigned int pos, const struct rcti *border, float zoomx, float zoomy)
 

Typedef Documentation

◆ IMMDrawPixelsTexState

Function Documentation

◆ ED_draw_imbuf()

void ED_draw_imbuf ( struct ImBuf ibuf,
float  x,
float  y,
bool  use_filter,
struct ColorManagedViewSettings view_settings,
struct ColorManagedDisplaySettings display_settings,
float  zoom_x,
float  zoom_y 
)

Definition at line 540 of file glutil.c.

References ED_draw_imbuf_clipping(), x, and y.

◆ ED_draw_imbuf_clipping()

void ED_draw_imbuf_clipping ( struct ImBuf ibuf,
float  x,
float  y,
bool  use_filter,
struct ColorManagedViewSettings view_settings,
struct ColorManagedDisplaySettings display_settings,
float  clip_min_x,
float  clip_min_y,
float  clip_max_x,
float  clip_max_y,
float  zoom_x,
float  zoom_y 
)

◆ ED_draw_imbuf_ctx()

void ED_draw_imbuf_ctx ( const struct bContext C,
struct ImBuf ibuf,
float  x,
float  y,
bool  use_filter,
float  zoom_x,
float  zoom_y 
)

Referenced by draw_movieclip_buffer().

◆ ED_draw_imbuf_ctx_clipping()

void ED_draw_imbuf_ctx_clipping ( const struct bContext C,
struct ImBuf ibuf,
float  x,
float  y,
bool  use_filter,
float  clip_min_x,
float  clip_min_y,
float  clip_max_x,
float  clip_max_y,
float  zoom_x,
float  zoom_y 
)

◆ ED_draw_imbuf_method()

int ED_draw_imbuf_method ( struct ImBuf ibuf)

◆ immDrawBorderCorners()

void immDrawBorderCorners ( unsigned int  pos,
const struct rcti border,
float  zoomx,
float  zoomy 
)

Don't move to GPU_immediate_util.h because this uses user-prefs and isn't very low level.

Referenced by blender::ed::space_node::draw_nodespace_back_pix(), and draw_render_info().

◆ immDrawPixelsTexScaledFullSize()

void immDrawPixelsTexScaledFullSize ( const IMMDrawPixelsTexState state,
float  x,
float  y,
int  img_w,
int  img_h,
eGPUTextureFormat  gpu_format,
bool  use_filter,
const void rect,
float  scaleX,
float  scaleY,
float  xzoom,
float  yzoom,
const float  color[4] 
)

Unlike the immDrawPixelsTexTiled functions, this doesn't do tiled drawing, but draws into a full texture.

Use the currently bound shader.

Use immDrawPixelsTexSetup to bind the shader you want before calling #immDrawPixelsTex.

If using a special shader double check it uses the same attributes "pos" "texCoord" and uniform "image".

If color is NULL then use white by default

Unless state->do_shader_unbind is explicitly set to false, the shader is unbound when finished.

Definition at line 59 of file glutil.c.

References color, ELEM, GPU_DATA_FLOAT, GPU_DATA_UBYTE, GPU_PRIM_TRI_FAN, GPU_R16F, GPU_RGB16F, GPU_RGBA16F, GPU_shader_get_uniform(), GPU_texture_bind(), GPU_texture_create_2d(), GPU_texture_filter_mode(), GPU_texture_free(), GPU_texture_generate_mipmap(), GPU_texture_mipmap_mode(), GPU_texture_unbind(), GPU_texture_update(), GPU_texture_wrap_mode(), immAttr2f(), immBegin(), immEnd(), immUnbindProgram(), immUniformColor4fv(), immVertex2f(), NULL, pos, state, tex, x, and y.

Referenced by icon_draw_rect().

◆ immDrawPixelsTexSetup()

IMMDrawPixelsTexState immDrawPixelsTexSetup ( int  builtin)

To be used before calling #immDrawPixelsTex Default shader is GPU_SHADER_2D_IMAGE_COLOR You can still set uniforms with: GPU_shader_uniform_int(shader, GPU_shader_get_uniform(shader, "name"), 0);

Definition at line 44 of file glutil.c.

References GPU_shader_get_builtin_shader(), immBindBuiltinProgram(), immDrawPixelsTexSetupAttributes(), immUniform1i(), and state.

Referenced by draw_filled_lasso(), ED_draw_imbuf_clipping(), ED_mask_draw_region(), ed_preview_draw_rect(), file_draw_preview(), icon_draw_rect(), blender::ed::space_node::node_draw_preview(), ui_draw_but_IMAGE(), and wm_drag_draw_icon().

◆ immDrawPixelsTexTiled()

void immDrawPixelsTexTiled ( IMMDrawPixelsTexState state,
float  x,
float  y,
int  img_w,
int  img_h,
eGPUTextureFormat  gpu_format,
bool  use_filter,
void rect,
float  xzoom,
float  yzoom,
const float  color[4] 
)

#immDrawPixelsTex - Functions like a limited glDrawPixels, but actually draws the image using textures, which can be tremendously faster on low-end cards, and also avoids problems with the raster position being clipped when off-screen. Pixel unpacking parameters and the glPixelZoom values are not respected.

Attention
Use immDrawPixelsTexSetup before calling this function.
This routine makes many assumptions: the rect data is expected to be in RGBA byte or float format, and the model-view and projection matrices are assumed to define a 1-to-1 mapping to screen space.

Definition at line 333 of file glutil.c.

References color, immDrawPixelsTexTiled_scaling_clipping(), state, x, and y.

Referenced by draw_filled_lasso(), ED_mask_draw_region(), ed_preview_draw_rect(), blender::ed::space_node::node_draw_preview(), and ui_draw_but_IMAGE().

◆ immDrawPixelsTexTiled_clipping()

void immDrawPixelsTexTiled_clipping ( IMMDrawPixelsTexState state,
float  x,
float  y,
int  img_w,
int  img_h,
eGPUTextureFormat  gpu_format,
bool  use_filter,
void rect,
float  clip_min_x,
float  clip_min_y,
float  clip_max_x,
float  clip_max_y,
float  xzoom,
float  yzoom,
const float  color[4] 
)

Definition at line 364 of file glutil.c.

References color, immDrawPixelsTexTiled_scaling_clipping(), state, x, and y.

Referenced by ED_draw_imbuf_clipping().

◆ immDrawPixelsTexTiled_scaling()

void immDrawPixelsTexTiled_scaling ( IMMDrawPixelsTexState state,
float  x,
float  y,
int  img_w,
int  img_h,
eGPUTextureFormat  gpu_format,
bool  use_filter,
void rect,
float  scaleX,
float  scaleY,
float  xzoom,
float  yzoom,
const float  color[4] 
)

Definition at line 300 of file glutil.c.

References color, immDrawPixelsTexTiled_scaling_clipping(), state, x, and y.

Referenced by file_draw_preview(), and wm_drag_draw_icon().

◆ immDrawPixelsTexTiled_scaling_clipping()

void immDrawPixelsTexTiled_scaling_clipping ( IMMDrawPixelsTexState state,
float  x,
float  y,
int  img_w,
int  img_h,
eGPUTextureFormat  gpu_format,
bool  use_filter,
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,
const float  color[4] 
)

Use the currently bound shader.

Use immDrawPixelsTexSetup to bind the shader you want before calling #immDrawPixelsTex.

If using a special shader double check it uses the same attributes "pos" "texCoord" and uniform "image".

If color is NULL then use white by default

Unless state->do_shader_unbind is explicitly set to false, the shader is unbound when finished.

Definition at line 130 of file glutil.c.

References BLI_assert_msg, bottom, color, data, DATA, ELEM, GPU_DATA_FLOAT, GPU_DATA_UBYTE, GPU_flush(), GPU_PRIM_TRI_FAN, GPU_R16F, GPU_R8, GPU_RGB16F, GPU_RGBA16F, GPU_RGBA8, GPU_shader_get_uniform(), GPU_texture_bind(), GPU_texture_create_2d(), GPU_texture_filter_mode(), GPU_texture_free(), GPU_texture_unbind(), GPU_texture_update_sub(), GPU_texture_wrap_mode(), GPU_unpack_row_length_set(), immAttr2f(), immBegin(), immEnd(), immUnbindProgram(), immUniformColor4fv(), immVertex2f(), left, NULL, offset, pos, right, state, stride, tex, top, UNPACK2, x, and y.

Referenced by immDrawPixelsTexTiled(), immDrawPixelsTexTiled_clipping(), and immDrawPixelsTexTiled_scaling().