DRW: Fix background image display

This make the workbench draw everything in the background routine just like
eevee. This is because the workbench uses floating point buffers too and
rendering background to this buffer makes it incorrect without proper
color management.

This could be improved because in xray the background is not blended but
dithered as it's drawn after the main pass.
This commit is contained in:
Clément Foucault 2018-08-21 10:22:25 +02:00
parent bb639ccc47
commit 6489243332
Notes: blender-bot 2023-02-14 09:19:09 +01:00
Referenced by commit 085329f114, Fix T81002: Images drawn with the Python gpu module no longer draw on top in the Image Editor
5 changed files with 5 additions and 14 deletions

View File

@ -65,11 +65,6 @@ static void workbench_solid_draw_background(void *vedata)
{
WORKBENCH_Data *data = vedata;
workbench_deferred_draw_background(data);
}
static void workbench_solid_draw_scene(void *vedata)
{
WORKBENCH_Data *data = vedata;
workbench_deferred_draw_scene(data);
workbench_deferred_draw_finish(data);
}
@ -113,7 +108,7 @@ DrawEngineType draw_engine_workbench_solid = {
&workbench_solid_cache_populate,
&workbench_solid_cache_finish,
&workbench_solid_draw_background,
&workbench_solid_draw_scene,
NULL,
&workbench_solid_view_update,
&workbench_solid_id_update,
&workbench_render_to_image,

View File

@ -63,11 +63,6 @@ static void workbench_transparent_draw_background(void *vedata)
{
WORKBENCH_Data *data = vedata;
workbench_forward_draw_background(data);
}
static void workbench_transparent_draw_scene(void *vedata)
{
WORKBENCH_Data *data = vedata;
workbench_forward_draw_scene(data);
workbench_forward_draw_finish(data);
}
@ -95,7 +90,7 @@ DrawEngineType draw_engine_workbench_transparent = {
&workbench_transparent_cache_populate,
&workbench_transparent_cache_finish,
&workbench_transparent_draw_background,
&workbench_transparent_draw_scene,
NULL,
&workbench_transparent_view_update,
NULL,
NULL,

View File

@ -1458,10 +1458,10 @@ void DRW_draw_render_loop_ex(
}
if (do_bg_image) {
GPU_framebuffer_bind(DST.default_framebuffer);
ED_view3d_draw_bgpic_test(scene, depsgraph, ar, v3d, false, true);
}
DRW_draw_callbacks_pre_scene();
if (DST.draw_ctx.evil_C) {
ED_region_draw_cb_draw(DST.draw_ctx.evil_C, DST.draw_ctx.ar, REGION_DRAW_PRE_VIEW);

View File

@ -679,7 +679,7 @@ static void view3d_draw_bgpic(Scene *scene, Depsgraph *depsgraph,
ibuf = ibuf->mipmap[mip - 1];
}
GPU_depth_test(false);
GPU_depth_test(!do_foreground);
glDepthMask(GL_FALSE);
GPU_blend(true);

View File

@ -9,5 +9,6 @@ out vec2 texCoord_interp;
void main()
{
gl_Position = ModelViewProjectionMatrix * vec4(pos.xy, 0.0f, 1.0f);
gl_Position.z = 1.0;
texCoord_interp = texCoord;
}