White pixels on WindowsGL

i want to know why when i build my project with WindowsGL appear several white pixels



Hi @khofez. Are you able to send us the texture and/or XNB file for that image? And a snippet of the code used to render it?

here is the image

and here is my code:

        public void Render(SpriteBatch spriteBatch)
       spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null, null, camera.View);

        //draw (sprite, pos, sourcerect, Color, rotation, origin, scale, spriteeffects, depth)

The forum may process the image, so we might not be seeing the exact same image as you. Could you upload it somewhere and post a link to it?

ok i uploaded on dropbox. Btw, its not just that image , all the images that I load render with white pixels, i mean, there some sprites that doesnt, but most of them does


How are you loading the image?
Are you converting to an XNB or using LoadStream?
If you are converting, what are you using to do the conversion, what command line?
Otherwise, what parameters are you providing to LoadStream?

Looking at the image, those errant pixels do not have a completely zero alpha value. The alpha values vary from 1 to 5. So it looks like it using blended alpha in DirectX and cut-out alpha in OpenGL.

@daveleaver im loading it in png fomat not xnb

@KonajuGames you were right. I couldn’t see with my eyes because the alpha values were very small that I can’t see in the png image, but monogame was rendering those pixels with a very small alpha value with white pixels, so i edited the image and selected the transparent background, and I deleted it many times. But, for some reason, DX was not rendering those small alpha values and GL was… Anyway, i fixed it, i just have to be sure that i have to select the transparent background and delete it (even if I dont see any white pixel). Thank you

I suspect the PNG loader is loading them different on the two platforms, one will be treating them as having premultiplied alpha, and the other will be treating them as non-premultiplied (which is what they probably are).

Loading PNG on android will treat them as premultiplied, so probably the same here.

In XNA, loading a PNG through Texture2D.FromStream() does not pre-multiply, so we will have to make sure all platforms behave consistently.

1 Like

The same thing happens to me. I made another project with same textures but used the content project which fixed the problem. What do I do if in my project I can’t use the content project?(Because I’m making a game engine and the user of the game engine will always have his textures in the filesystem)