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

Pages: [1]
1
Graphics / Re: SFML Tile Map Tearing
« on: May 30, 2014, 07:01:54 pm »
Thanks Nexus,

While minifying code I've tracked 99% of the tearing down to anti-aliasing. I only get very small vertical tears now while jumping, probably due to another significant rounding mistake. There is no tearing now while not moving. Do you have any explanation as to why this has such a drastic effect? I understand it's not absolutely necessary in my case due to the pixelart style of the application; but I didn't see any harm in using it anyway.

I have indeed made a small code sample: It's mostly based on the example given in the tutorial:

Main.cpp:
(click to show/hide)

Tilemap.hpp:
(click to show/hide)

I've attached a small tileset for demonstration purposes. Commenting/uncommenting line 9 in Main.cpp shows some tearing (at least on my systems).

So again, thanks for all your help! :)


2
Graphics / Re: SFML Tile Map Tearing
« on: May 30, 2014, 03:57:18 pm »
I might be able to get it working with sprites but I would rather not; the maps can get rather big.
Would it be possible to post the entire solution? I've already tried starting a clean version but I can't really reproduce the error in a very minimal environment.

3
Graphics / Re: SFML Tile Map Tearing
« on: May 29, 2014, 03:41:06 pm »
I had not read that no, thanks for the resource!
However, I don't feel like I'm breaking any of those guidelines:

The object's position, origin and scale have no fractional part.

The TileMap is a VertexArray; I have tried flooring all of it's components but it's built from integers (like in the official tutorial).

The object's and the view's rotation are a multiple of 90 degrees.
No rotation so I think I'm pretty much fine here.

The view's center and size have no fractional part.
The views center is the players position, as you can see I have floored it (I have tried rounding it as well). The size is based on the size of the window (divided by 2) but I also floor/round this value just in case.

I'm obviously doing something wrong but I cant figure out what it is exactly.

4
Graphics / Re: SFML Tile Map Tearing
« on: May 28, 2014, 11:47:28 pm »
Sorry guys, still haven't fixed it. Can anyone give me some guidance as to why this is happening?

5
Graphics / Re: SFML Tile Map Tearing
« on: May 26, 2014, 10:17:05 pm »
Seems like it isn't fully fixed; it just 'looks' like it works at specific resolutions/view sizes.

I've set the render window to 1920*1080 resolution. When I resize it to fullscreen (2560*1440) tearing occurs.
The difference is extremely small (it seems to be just 1 pixel) so this indeed seems like a rounding error.

From my personal experience that occurred when position was not rounded value.
Seeing you fixed it but you can still use std::floor(value) to get rounded down decimal value.

What do you mean exactly? I already round the position.x and position.y in the previous code snippet:

playerView.setCenter(floor(player.getPosition().x), floor(player.getPosition().y));

So, this question is open again! Any pointers?

6
Graphics / Re: SFML Tile Map Tearing
« on: May 24, 2014, 02:26:40 pm »
I think I've fixed it. The rounding error seemed to be in the view.setCenter().

The 'fixed' code is as follows:

Main.cpp
(click to show/hide)

7
Graphics / SFML Tile Map Tearing
« on: May 24, 2014, 12:39:12 pm »
Greetings,

As many others here I've recently started developing a small game in my spare time.
I have a decent amount of experience with c++ and feel comfortable enough to take this next step,
including school courses I have around 20 weeks of experience using raw OpenGL (1.1 & 3.2+) as well.

I started by making a small tile map, according to the tutorial found here:
http://www.sfml-dev.org/tutorials/2.1/graphics-vertex-array.php

This tutorial is extremely self explanatory and I didn't have any issues getting it up and running.
After some messing with view (I want to be able to scale my map up and down) I have been getting issues;
Tile tearing occurs and I'm left with something like this:

Image: Tile map 'tearing' occuring.
(click to show/hide)

I did some research (Yes I really did!) and I found a really promising solution here:
http://en.sfml-dev.org/forums/index.php?topic=6665.0

But the offsetting by 0.0075 just doesn't seem to work. (It does feel like it's getting closer)
I tried flooring some of the values while building the Vertex Array but to no avail.
The linked post doesn't seem to exist anymore, which is a shame since it might give me some clarity on the subject.

The important parts of the code are the following:

Building the Vertex Array:
(click to show/hide)

Drawing the Tile Map:
(click to show/hide)

Drawing the 'Game':

(click to show/hide)

I'm really hoping you guys can help me out!

Thanks in advance for any pointers in the right direction.

Yours sincerely,
Oxy

Pages: [1]