Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: VertexArray indexing problem  (Read 2960 times)

0 Members and 1 Guest are viewing this topic.

Spans

  • Newbie
  • *
  • Posts: 5
    • View Profile
VertexArray indexing problem
« on: November 23, 2013, 12:14:40 pm »
Hi

For some reason, when I index a location on a VertexArray higher than the array's capacity, the game force-closes without any trace or error.

Minimal code:
Code: [Select]
        static void Main(string[] args)
        {
            RenderWindow window = new RenderWindow(new VideoMode(800, 600), "Vertex Test", Styles.Close, new ContextSettings() { AntialiasingLevel = 2 });
            window.Closed += (s, e) => { window.Close(); };

            VertexArray vertices = new VertexArray(PrimitiveType.Quads, 4);

            vertices[4] = new Vertex(new Vector2f(10, 10), Color.Red);

            while (window.IsOpen())
            {
                window.DispatchEvents();

                window.Draw(vertices);

                window.Display();
            }
        }

I'm using SFML.NET 2.1 on Windows 7, Visual Studio 2010.
« Last Edit: November 23, 2013, 12:17:15 pm by Spans »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: VertexArray indexing problem
« Reply #1 on: November 23, 2013, 12:40:12 pm »
And? This is an undefined behaviour, anything can happen.
Laurent Gomila - SFML developer

Spans

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: VertexArray indexing problem
« Reply #2 on: November 23, 2013, 01:19:58 pm »
Sorry, I was just wondering why no errors or traces are thrown.