macroquad icon indicating copy to clipboard operation
macroquad copied to clipboard

Issue with drawing same Texture2D with same Material in a row

Open vdrn opened this issue 2 years ago • 1 comments

When trying to draw the same Texture2D twice using the same Material, one right after the other, like this:

gl_use_material(m);
draw_texture_ex(tex, ..);
gl_use_default_material();

// ... no other draw calls in between..

gl_use_material(m);
draw_texture_ex(tex, ..);
gl_use_default_material();

Texture uniform inside the second draw call shader will not be tex but the screen texture (same as _ScreenTexture).

Note: A workaround I use is to draw a transparent rect in between.

vdrn avatar Jul 31 '22 00:07 vdrn

Same thing seems to happen :

let context = unsafe { get_internal_gl().quad_gl };
gl_use_material(m);
context.texture(None);
context.draw_mode(DrawMode::Triangles);
context.geometry(&vertices, &indices);
gl_use_default_material();

// .. no other draw calls

tiled_map.draw_tiles(...)

Tiles will be drawn with with screen texture as tileset

vdrn avatar Aug 02 '22 17:08 vdrn