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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Krechet

Pages: [1]
1
Graphics / Re: Perspective distortion issue
« on: February 16, 2024, 11:30:57 am »
For Perspective Texture Mapping you'll need to supply some sort of depth value. This article explains more: https://mtrebi.github.io/2017/03/15/texture-mapping-affine-perspective.html
Magic! But its working)) Thanks a lot!

2
Graphics / Perspective distortion issue [Solved]
« on: February 15, 2024, 07:06:29 pm »
Hi all. I'm trying to draw a distorted square to simulate perspective. I use rendering through an array of vertices. And as a result I get a strange picture. I tried using different vertices modes (PrimitiveType.Quads and PrimitiveType.Triangles), the result was the same.
I would be very grateful if anyone could suggest a solution on how to get the correct picture.
(Sample in attach )

3
Graphics / Re: Tiled map draw algorithm
« on: August 18, 2020, 07:16:25 pm »
Quote
Using a single vertex array for the whole map would be a better solution
Thanks a lot!

4
Graphics / Tiled map draw algorithm
« on: August 18, 2020, 05:13:59 pm »
Hey guys!
I'm new with SFML, can anyone give me a little advice?
I want to draw big tiled map. I'm going to use something like that:
sf::Texture texture;
sf::Sprite sprite;
texture.loadFromFile("tileAtlas.png"); //Big texture with all tiles
...
for (i = 0; i < mapWidth; i++) {
  for (j = 0; j < mapHeight; j++) {
    sprite.setTextureRect(..); //Change sprite to appropriate tile
    sprite.move(...); //Move sprite to position of tile (i,j)
    window.draw(sprite);
Is it good practice? Or better to create big array of sf::Sprite?

And another question: do I need to manually check if sprite is on screen (before draw) when using View? Or I can call "draw" to all my big amount of sprites?

Pages: [1]
anything