Welcome,
Guest
. Please
login
or
register
. Did you miss your
activation email?
French forum
Home
Help
Search
Login
Register
SFML community forums
»
Help
»
Graphics
»
How to add a range of vertices to a sf::VertexArray?
Print
Pages: [
1
]
Author
Topic: How to add a range of vertices to a sf::VertexArray? (Read 1765 times)
0 Members and 1 Guest are viewing this topic.
Rob92
Newbie
Posts: 35
How to add a range of vertices to a sf::VertexArray?
«
on:
February 16, 2016, 02:12:53 am »
I was wondering if it is possible to add more than 1 vertex at a time to an sf::VertexArray.
At the moment I use the append function but I thought that I might be able to increase performance by adding multiple vertices at once. Is that possible without modifying the source code?
Logged
Hapax
Hero Member
Posts: 3379
My number of posts is shown in hexadecimal.
Re: How to add a range of vertices to a sf::VertexArray?
«
Reply #1 on:
February 16, 2016, 03:14:21 am »
You can set the number of vertices in a vertex array during
construction
:
sf
::
VertexArray
vertexArray
(
sf
::
Points
,
100
)
;
// 100 vertices
and/or you can
resize
it later:
vertexArray.
resize
(
200
)
;
// now 200 vertices
Logged
Selba Ward
-SFML drawables
Cheese Map
-Drawable Layered Tile Map
Kairos
-Timing Library
Grambol
*
Hapaxia Links
*
Laurent
Administrator
Hero Member
Posts: 32498
Re: How to add a range of vertices to a sf::VertexArray?
«
Reply #2 on:
February 16, 2016, 09:31:08 am »
If you need maximum performances then you'd better use a std::vector<sf::Vertex> directly. sf::VertexArray is just a convenience wrapper, which offers a limited interface to std::vector operations.
Logged
Laurent Gomila - SFML developer
Rob92
Newbie
Posts: 35
Re: How to add a range of vertices to a sf::VertexArray?
«
Reply #3 on:
February 16, 2016, 01:15:24 pm »
Thanks, ill try using a vector
Logged
Print
Pages: [
1
]
SFML community forums
»
Help
»
Graphics
»
How to add a range of vertices to a sf::VertexArray?