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 - Octav

Pages: [1] 2
1
Graphics / Re: Strange distortion bug when zooming with a sf::View
« on: July 27, 2013, 08:30:27 pm »
:-\
What about removing all 0.5fs from both textures and positions?

Nope. Still horrible distorsion.(...)
*grumble grumble*  >:(

I'm sorry about that, silly mistake, because I didn't add the 0.5f and I didn't realize it was added to the X and Y coords. That position has two sizes, and I was only deleting the ones at the end, silly mistake  ;D

2
Graphics / Re: Strange distortion bug when zooming with a sf::View
« on: July 27, 2013, 07:18:35 pm »
Fixed it.

Earlier, I had this code:
 // Set their texture bounding box
                up_l_point.texCoords =   sf::Vector2f((j%tiles_per_row) * tile_size +0.5f, (j/tiles_per_row) * tile_size +0.5f);
                up_r_point.texCoords =   sf::Vector2f((j%tiles_per_row * tile_size) + tile_size-0.5f, (j/tiles_per_row) * tile_size+0.5f);
                down_r_point.texCoords = sf::Vector2f((j%tiles_per_row) * tile_size + tile_size-0.5f, (j/tiles_per_row * tile_size) + tile_size-0.5f);
                down_l_point.texCoords = sf::Vector2f((j%tiles_per_row) * tile_size +0.5f, (j/tiles_per_row * tile_size) + tile_size-0.5f);

And removing 0.5f did the trick. Apparently that kills the whole thing. It wasn't a bug with the camera, it was a bug with the way I programmed the vertexarray. It looks perfect now. Thanks a lot everyone!

3
Graphics / Re: Strange distortion bug when zooming with a sf::View
« on: July 27, 2013, 06:04:08 pm »
Alright a person told me that for him, my code works fine, but he is using SFML 2.1 and I am using the old version. I will try to install 2.1 and get back to this thread.

4
Graphics / Re: Strange distortion bug when zooming with a sf::View
« on: July 27, 2013, 06:01:41 pm »
I don't quite understand this, however even without a zoom you can notice some strange graphical bugs
Are your graphics driver uptodate?

Yes, and I don't work alone on this project, and my teammate and other people have had the same distorsion bug.

I don't quite understand this, however even without a zoom you can notice some strange graphical bugs
Can you put together a minimal and complete example that reproduces the problem, so we can test it on our own and see if it's related to your hardware, a mistake in the code or an actual OpenGL issue.

I already have, and it only uses a simple sprite, check page 1

5
Graphics / Re: Strange distortion bug when zooming with a sf::View
« on: July 27, 2013, 05:35:40 pm »
If it renders good with no zoom you could try to render it to a texture that has default view without zooms before drawing it to window with zoomed view, have you tried that?

I don't quite understand this, however even without a zoom you can notice some strange graphical bugs

6
Graphics / Re: Strange distortion bug when zooming with a sf::View
« on: July 27, 2013, 05:18:50 pm »
:-\
What about removing all 0.5fs from both textures and positions?

Nope. Still horrible distorsion. Here's the code for my zooming:

if(sf::Keyboard::isKeyPressed(sf::Keyboard::F5) && zoomTimer < 0) {camera.zoom(0.9f); zoomTimer = 0.02f;}
   if(sf::Keyboard::isKeyPressed(sf::Keyboard::F6) && zoomTimer < 0) {camera.zoom(1.1f); zoomTimer = 0.02f;}

7
Graphics / Re: Strange distortion bug when zooming with a sf::View
« on: July 27, 2013, 04:59:38 pm »
I mean like this so that it'd create 1:1 mapping between coordinates and texture pixels:
// Set their positions
                up_l_point.position =   sf::Vector2f((float)(index*tile_size) + 0.5f, (float)(index_y*tile_size)+0.5f);
                up_r_point.position =   sf::Vector2f((float)(index*tile_size + tile_size)-0.5f, (float)(index_y*tile_size)+0.5f);
                down_r_point.position = sf::Vector2f((float)(index*tile_size + tile_size)-0.5f, (float)(index_y*tile_size + tile_size)-0.5f);
                down_l_point.position = sf::Vector2f((float)(index*tile_size)+0.5f, (float)(index_y*tile_size + tile_size)-0.5f);

That seems to produce a better result, however, it also creates a border between the tiles.

8
Graphics / Re: Strange distortion bug when zooming with a sf::View
« on: July 27, 2013, 04:53:52 pm »
Did you try adding and subtracting 0.5 to the positions like you do to textures so that positions too end with 0.5 and tile is tile_size-1.f wide and high?

Yes, I tried that as well, and the tile_size is 32x32

9
Graphics / Re: Strange distortion bug when zooming with a sf::View
« on: July 27, 2013, 04:38:20 pm »
How are you drawing that? VertexArrays? Sprites? Something else?

VertexArray. Also we tried setSmooth() but it doesn't help much. It still keeps some very ugly distorsion, it just messes it up even more.

void MapLayer::ConstructMap()
{
        mapVertices.clear();

        int index = 0;
        int index_y = 0;

        for(auto&& i : tileData)
        {
                for(auto&& j : i)
                {
                                //====================================================================\\
                                // Figure showing the quad order. Important.                          \\
                                //====================================================================\\
                                //  (up_l_point)    (up_r_point)       |                              \\
                                //        +-----------+                |        (1)    (2)            \\
                                //        |           |                |          +----+              \\
                                //        |           |                |          |    |              \\
                                //        |           |                |          +----+              \\
                                //        |           |                |        (4)    (3)            \\
                                //        +-----------+                |                              \\
                                // (down_l_point)     (down_r_point)   |    Order of the points       \\
                                //====================================================================\\

                                // Declare 4 points of the quad
                                sf::Vertex up_l_point;
                                sf::Vertex up_r_point;
                                sf::Vertex down_r_point;
                                sf::Vertex down_l_point;

                                // Set their positions
                                up_l_point.position =   sf::Vector2f((float)(index*tile_size), (float)(index_y*tile_size));
                                up_r_point.position =   sf::Vector2f((float)(index*tile_size + tile_size), (float)(index_y*tile_size));
                                down_r_point.position = sf::Vector2f((float)(index*tile_size + tile_size), (float)(index_y*tile_size + tile_size));
                                down_l_point.position = sf::Vector2f((float)(index*tile_size), (float)(index_y*tile_size + tile_size));

                                 // Set their texture bounding box
                up_l_point.texCoords =   sf::Vector2f((j%tiles_per_row) * tile_size +0.5f, (j/tiles_per_row) * tile_size +0.5f);
                up_r_point.texCoords =   sf::Vector2f((j%tiles_per_row * tile_size) + tile_size-0.5f, (j/tiles_per_row) * tile_size+0.5f);
                down_r_point.texCoords = sf::Vector2f((j%tiles_per_row) * tile_size + tile_size-0.5f, (j/tiles_per_row * tile_size) + tile_size-0.5f);
                down_l_point.texCoords = sf::Vector2f((j%tiles_per_row) * tile_size +0.5f, (j/tiles_per_row * tile_size) + tile_size-0.5f);

                                mapVertices.append(up_l_point);
                                mapVertices.append(up_r_point);
                                mapVertices.append(down_r_point);
                                mapVertices.append(down_l_point);

                                index++;
                }
                index = 0;
                index_y++;
        }
}

10
Graphics / Re: Strange distortion bug when zooming with a sf::View
« on: July 27, 2013, 04:20:50 pm »
You guys are saying this is normal, but just look at this image.



I want to release a game to a wider audience. Those are horizontal pixels. And no matter what I zoom, it stays distorted, we have tried the smallest scales possible. I have tried everything. There has to be a cause to this, because this is horrible. I spend hours on artwork, and to see it look like this in-game is so terrible :/

11
Graphics / Re: Strange distortion bug when zooming with a sf::View
« on: July 24, 2013, 01:33:47 pm »
We tried that, and it works, I'm not sure if we'll use the smoothening, we might just keep this small distortion right now, we're only worried because we plan to commercialize the game

12
Graphics / Re: Strange distortion bug when zooming with a sf::View
« on: July 24, 2013, 10:41:17 am »
Alright, I just thought that it wasn't supposed to be like that, because when I make the artwork and see it a bit distorted it ruins some of my plans.

13
Graphics / Re: Strange distortion bug when zooming with a sf::View
« on: July 23, 2013, 03:58:39 pm »
Okay, I've managed to reproduce this bug on a very small scale, it's not as serious as in the game but it's the same bug, you can clearly see a distortion when you zoom in or out. I didn't want to include our whole map system so I just made it load a picture of a map. I know it's not the same as a vertexarray, but it's as minimal as I can get.

14
Graphics / Re: Strange distortion bug when zooming with a sf::View
« on: July 22, 2013, 10:29:36 pm »
Quote
There is literally no zoom level that actually doesn't make things distorted
An exact x2 zoom doesn't give a perfect result?

We have tried all sorts of methods, including just using a precise setSize, and we've set a very small scale for zooming so that we can find a good non-distorted version of the game as well but no results. We've tried zooming for a specific factor, like 2x, 3x, etc, but still, there is a noticeable distorsion. Changing the texture size to 32x32 did make things appear a bit better, but not by much.

15
Graphics / Re: Strange distortion bug when zooming with a sf::View
« on: July 22, 2013, 08:58:30 pm »
There is literally no zoom level that actually doesn't make things distorted, I tried everything. Does anyone know the cause, or maybe a fix? :/

Pages: [1] 2
anything