Why does it happen with MonoGame's SpriteBatch on Ubuntu 18.04

Hello everyone, why does it happen like it looks crazy because I am using Ubuntu “native” to my computer. PS I removed Windows 10 and sell Windows 10 Pro.

Why does SpriteBatch flicker sensationally?

// EDIT: I already updated driver but it still flicker …

Thanks!

You are creating a new texture every frame, including all the resources that are attached to it. That’s getting very costly very quickly. You should create the texture once in the beginning, in the LoadContent function for example.

Also your code assumes that just calling the Texture constructor will give you a white texture by default. Maybe that’s the case, I’m not sure. Maybe you need to call Texture2D.SetData first to initialize it with white pixels.

Thanks for help! That is really bit crazy workarounds - If you made new Texture2D than it looks like flicker.

I know that like trick:

    GraphicsDevice.Clear(Color.CornflowerBlue);

// TODO: Add your drawing code her

    // Make a 1x1 texture named pixel.  
Texture2D pixel = new Texture2D(GraphicsDevice, 1, 1);
Texture2D pixel2 = new Texture2D(GraphicsDevice, 1, 1);  
     
    // Create a 1D array of color data to fill the pixel texture with.  
    Color[] colorData =
{  
	Color.White
    };

// Set the texture data with our color information.  
    pixel.SetData<Color>(colorData);
pixel2.SetData<Color>(colorData);

Color orange_alpha = new Color(255, 125, 0, 50);
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive);

spriteBatch.Draw(pixel, new Rectangle(10, 10, 100, 100), orange_alpha);
spriteBatch.Draw(pixel2, new Rectangle(20, 20, 100, 100), orange_alpha);
spriteBatch.End();