I created a simple test project in which I load the following 16x8 texture:
Then I color the background using
GraphicsDevice.Clear(new Color(10, 10, 10)) and simply draw the first 8x8 rectangle of the texture, and, as expected, I get the following:
but the black pixels are not all RGB 10,10,10 but they appear as indicated below:
Is this normal?
I created this little test because I coded a game some time ago and a user says that on his monitor he can clearly distinguish pixels with RGB 10,10,10 from those with RGB 12,12,12 and with RGB 14,14,14 and he reports to see gray dots and lines on a black background.
PS: It only seems to happen on OpenGL projects and not on DirectX projects.
I don’t get that kind of bug. Are you sure the tiles are drawn correctly? What if you don’t draw any texture, just the color of the background? What if you draw a pre-edited but transparent image that looks like the current tiles? And what if you set a background by loading a completely black image behind the tiles and not using GraphicsDevice.Clear?
If you’re not using point filtering when you draw the texture, this will happen. Make sure you’re using, say, PointClamp in your SpriteBatch.Begin call.
That’s usually the cause of stuff like this. If you’re already doing this, it might help to post the minimum amount of code you need to reproduce this.
Yes, PointClamp has solved the problem.
Thank you very much.