sahap
sahap

Reputation: 389

Monogame Texture without colors

I can't find solution for this problem:

I'm using VertexPositionTexture to create rectangle with texture and DrawUserPrimitives to draw some primitives.

Rectangle is:

tmpPoint.VerticesList[0] = new VertexPositionTexture(new Vector3(-size, size, 0), new Vector2(0, 0));
tmpPoint.VerticesList[1] = new VertexPositionTexture(new Vector3(size, size, 0), new Vector2(1f, 0));
tmpPoint.VerticesList[2] = new VertexPositionTexture(new Vector3(-size, -size, 0), new Vector2(0, 1f));
tmpPoint.VerticesList[3] = new VertexPositionTexture(new Vector3(size, -size, 0), new Vector2(1f, 1f));

Effect setted up:

Effect = new BasicEffect(game.GraphicsDevice) {
    VertexColorEnabled = true,
    TextureEnabled = true };
Effect.EnableDefaultLighting();

And drawing method:

public void DrawRectangle()
{
    originalBlend = game.GraphicsDevice.BlendState;
    game.GraphicsDevice.BlendState = BlendState.AlphaBlend;
    Effect.World = PointScale * PointRotation * PointTranslation;
    Effect.CurrentTechnique.Passes[0].Apply();
    game.GraphicsDevice.DrawUserPrimitives<VertexPositionTexture>(PrimitiveType.TriangleStrip, VerticesList, 0, vertexBuffer.VertexCount / 2); 0, 0, 4, 0, 2);
    game.GraphicsDevice.BlendState = originalBlend;
}

All fine, but rectangle with texture has no colors, only alpha channel and gradients of black. It looks like this: enter image description here

but image for texture is:

enter image description here

When I tried to remove:

Effect.EnableDefaultLighting();
Effect.LightingEnabled = true;
VertexColorEnabled = true;

Colors are working...

You may be confused, but it already works fine with colors on machine with Windows 7. When I checked-in in TFS all changes, and get latest version on Windows 10 machine, I have this problem. I haven't Windows 7 machine yet. But I checked on another machine with Windows 7 executables, no success...

On host machine with no problems:

loaded assemblies(listed only with differences):

On another Windows 10(any version of Windows 7+) machine with problems (no difference):

loaded assemblies(listed only with differences):

Opened issue: https://github.com/mono/MonoGame/issues/5029

UPDATE: It seems what it only not working on Intel HD Graphics, but on Radeon and NVidia works fine...

Upvotes: 3

Views: 636

Answers (1)

A Coday
A Coday

Reputation: 33

Not saying is the ultimate answer, but one very important thing to check is that you have the lastest driver version for the Intel graphics system.

Upvotes: 0

Related Questions