When I call draw with just 2 params it works fine, but when I want to set texture through RenderStates triangle is not displayed.
Texture loads well, can draw it without issue as Sprite.
I have also tried creating and filling RenderStates object every loop with no effects.
What am I doing wrong here?
public class Terrain
{ List
<Vertex
> triangles
= new List
<Vertex
>(); Texture imgGrass
; Sprite sprite
; RenderStates states
= new RenderStates
(); public Terrain
() { imgGrass
= new Texture
("Data/Gfx/grass.png"); imgGrass
.Repeated = true; states
.Texture = imgGrass
; sprite
= new Sprite
(imgGrass
); Vertex vertex
= new Vertex
(); vertex
.Position = new Vector2f
( 32,
32 ); vertex
.Color = Color
.White; vertex
.TexCoords = new Vector2f
( 0,
0); triangles
.Add(vertex
); vertex
.Position = new Vector2f
( 256,
32 ); vertex
.Color = Color
.White; vertex
.TexCoords = new Vector2f
( 100,
0); triangles
.Add(vertex
); vertex
.Position = new Vector2f
( 128,
128 ); vertex
.Color = Color
.White; vertex
.TexCoords = new Vector2f
( 0,
100); triangles
.Add(vertex
); } public void Draw
(RenderWindow window
) { //window.Draw(sprite); window
.Draw(triangles
.ToArray(), PrimitiveType
.Triangles, states
); } }