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

Author Topic: Triangles appearing when rendering vertexArrays  (Read 1488 times)

0 Members and 1 Guest are viewing this topic.

LarsXYZ

  • Newbie
  • *
  • Posts: 25
    • View Profile
Triangles appearing when rendering vertexArrays
« on: June 23, 2016, 11:16:23 am »
Link to code: https://gist.github.com/larsXYZ/750afb868b95b7867e6502be02b82d93

I am trying to learn how to use vertexarrays, but when I try to render them they spawn weird triangles. Why is this happening?

Picture of weird triangle: http://puu.sh/pCSPF/333100e8ab.jpg

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Triangles appearing when rendering vertexArrays
« Reply #1 on: June 23, 2016, 11:26:06 am »
Check the documentation and tutorial on how to use VertexArrays.

You create a vertex array with 25 elements and then you append additionally 25 elements by calling append(). Either don't allocate 25 elements and call append or if you allocate 25 elements you should access them with the indices.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/