macroquad icon indicating copy to clipboard operation
macroquad copied to clipboard

Text has black outline in render texture

Open creepersaur opened this issue 4 months ago • 4 comments

When rendering text to a render texture it has a strange black outline around it.

  • Text 1 was rendered to the render texture and draw_texture_ex() to the screen
  • Text 2 was draw_text_ex() directly
  • I call self.target_1.clone().unwrap().texture.set_filter(FilterMode::Nearest); right after making the target_1
Image

Creating the RenderTexture:

self.target_1 = Some(render_target(400.0, 400.0));

Drawing the texture

draw_texture_ex(
            &target_1.texture,
            rect.x + 5.0,
            rect.y + 5.0 + title_thickness,
            WHITE,
            DrawTextureParams {
                source: Some(Rect::new(
                    0.0,
                    0.0,
                    (400.0 - 5.0),
                    (400.0 - 35.0)
                )),
                ..Default::default()
            },
        );

creepersaur avatar Aug 16 '25 15:08 creepersaur

@not-fl3

Also do you have any idea why all my text becomes black sometimes? I think its part of this issue as well since it just becomes overly bold.

Image

creepersaur avatar Sep 04 '25 20:09 creepersaur

Also do you have any idea why all my text becomes black sometimes?

I also encounter the black text issue at seemingly random intervals. This is using draw_text_ex.

Reloading the font file via load_ttf_font seems to resolve the issue, so I wonder if it's not in fact an issue in drawing the font but rather loading it?

tom-sson avatar Nov 17 '25 06:11 tom-sson

Yeah I believe so. Another thing that happens is sometimes the entire text is a black block.

Changing the text and restarting seems to fix it, but it becomes bugged again randomly.

creepersaur avatar Nov 17 '25 09:11 creepersaur

@creepersaur and @tom-sson I opened a separate issue for that weird black text issue - it's affecting me too but it seems like a separate thing: https://github.com/not-fl3/macroquad/issues/1006

caspark avatar Nov 18 '25 08:11 caspark