Texture not drawing on cubes

Posted by Christian Frantz on Game Development See other posts from Game Development or by Christian Frantz
Published on 2013-06-30T10:15:29Z Indexed on 2013/06/30 10:28 UTC
Read the original article Hit count: 242

Filed under:
|

I can draw the cubes fine but they are just solid black besides the occasional lighting that goes on. The basic effect is being set for each cube also.

    public void Draw(BasicEffect effect)
    {
        foreach (EffectPass pass in effect.CurrentTechnique.Passes)
        {
            pass.Apply();
            device.SetVertexBuffer(vertexBuffer);
            device.Indices = indexBuffer;
            device.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, 8, 0, 12);
        }
    }

The cubes draw method. TextureEnabled is set to true in my main draw method. My texture is also loading fine.

    public Cube(GraphicsDevice graphicsDevice, Vector3 Position, Texture2D Texture)
    {
        device = graphicsDevice;
        texture = Texture;
        cubePosition = Position;

        effect = new BasicEffect(device);
    }

The constructor seems fine too. Could this be caused by the Vector2's of my VertexPositionNormalTexture? Even if they were out of order something should still be drawn other than a black cube

© Game Development or respective owner

Related posts about XNA

Related posts about c#