macroquad
macroquad copied to clipboard
Issue with drawing same Texture2D with same Material in a row
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.
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