Welcome,
Guest
. Please
login
or
register
. Did you miss your
activation email?
French forum
Home
Help
Search
Login
Register
SFML community forums
»
Help
»
Graphics
»
Drawing a non-homogeneous terrain
Print
Pages: [
1
]
Author
Topic: Drawing a non-homogeneous terrain (Read 1153 times)
0 Members and 1 Guest are viewing this topic.
darkonaito_
Newbie
Posts: 5
Drawing a non-homogeneous terrain
«
on:
March 21, 2023, 10:09:59 pm »
How would you go about drawing a terrain made up of different materials, hence different texture? Have a sprite for each tile or have a single sprite and changing both it's position and it's texture multiple times?
Logged
eXpl0it3r
SFML Team
Hero Member
Posts: 11034
Re: Drawing a non-homogeneous terrain
«
Reply #1 on:
March 22, 2023, 05:24:23 pm »
Depends a bit on how non-homogeneous it should be.
In simple terms, you can draw a tile map, where you have one texture with different materials on it, then you insert the map structure as vertices into a VertexArray and draw that with the different matching texture coordinates.
The tutorial has an simple example for that:
https://www.sfml-dev.org/tutorials/2.5/graphics-vertex-array.php#example-tile-map
Logged
Official FAQ:
https://www.sfml-dev.org/faq.php
Official Discord Server:
https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog:
https://duerrenberger.dev/blog/
Print
Pages: [
1
]
SFML community forums
»
Help
»
Graphics
»
Drawing a non-homogeneous terrain
anything