hiteshsuthar / rokon

Automatically exported from code.google.com/p/rokon
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

TileEngine has seams when used with a window. #116

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What version of Rokon are you using? Trunk at time of posting.

Using a window that I move around I get 1px seams between tiles unless I round 
the float I pass to setX\Y to 2 decimal places.

If I resize the window it flickers with seams even if I round the zoom value to 
two decimal places.

Original issue reported on code.google.com by Jor...@gmail.com on 13 Jul 2010 at 1:56

GoogleCodeExporter commented 8 years ago
I get this even without using the TileEngine (i.e. when I build the background 
with normal sprites).

Original comment by necrotic...@gmail.com on 13 Jul 2010 at 7:54

GoogleCodeExporter commented 8 years ago
Also, rounding doesn't seem to have any effect in my case - I get the 
seams/flickers even if I move the window in int increments.

Original comment by necrotic...@gmail.com on 13 Jul 2010 at 8:05

GoogleCodeExporter commented 8 years ago
Out of curiosity, how large are your sprites? How many are on screen at a time?

Original comment by Jor...@gmail.com on 14 Jul 2010 at 12:34

GoogleCodeExporter commented 8 years ago
I tried everything from 32x32 tiles to 880x500 ones. The problem seems to be 
not so much with the number of them (it happens with just 2 large tiles, for 
example) but with the texture size involved. 

If I use 100 tiles of 32x32, the seams only appear every two blocks or so (not 
consistent). I thought it might be a texture size limitation, so I tried using 
64x64 tiles, and the seams were again shown every two blocks. Did a lot of 
testing, and the appearance of seams was very inconsistent.

Original comment by necrotic...@gmail.com on 14 Jul 2010 at 6:12

GoogleCodeExporter commented 8 years ago
This problem has something to do with how the window is scaled to fill the 
screen if game size is different to the phone's native resolution. I'm using 
the following workaround to make the game size (and window size) the same as 
the screen's resolution:

DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
setGameSize(metrics.widthPixels, metrics.heightPixels);

This works for me on both the emulator and my Desire

Original comment by burlock....@gmail.com on 21 Jul 2010 at 1:31

GoogleCodeExporter commented 8 years ago
Also, along with my previous comment, when scrolling the window, the x and y 
has to be cast to an int or the seams will appear.

Original comment by burlock....@gmail.com on 21 Jul 2010 at 1:42

GoogleCodeExporter commented 8 years ago
Found the problem.

The display metrics in Android 1.5 were broken, and reported incorrect values. 
Now, if you don't explicitly specify an android:minSdkVersion of at least 4 
(i.e. Android 1.6) in your manifest, then your application will get the broken 
metrics, which mess up the Rokon scaling. If you target android:minSdkVersion 
4, the problem is solved.

Original comment by necrotic...@gmail.com on 22 Jul 2010 at 12:30

GoogleCodeExporter commented 8 years ago
I'm seeing the problem with android:minSdkVersion 5

Original comment by burlock....@gmail.com on 22 Jul 2010 at 12:55

GoogleCodeExporter commented 8 years ago
Well, setting the minSdkVersion to 4 only fixes part of the problem, in that 
the screenSize is no longer reported incorrectly. On my Desire this was enough 
because my game size is 800x480, so once the screen size got reported 
correctly, there was no longer any scaling involved.

But yeah, I just checked a 480x320 emulator, and the seams are still there. So 
if scaling is involved, then you'll get the seams.

Original comment by necrotic...@gmail.com on 22 Jul 2010 at 1:35

GoogleCodeExporter commented 8 years ago
This won't fix the issue if you're using a window to zoom either.

Original comment by estratto...@gmail.com on 22 Jul 2010 at 9:46

GoogleCodeExporter commented 8 years ago
Guys, what's the problem here? I'm not sure?

DisplayMetrics is broken on 1.5, but you need to build with 2.2 anyway, so you 
only get the broken DisplayMetrics on older versions, right?

The seams problem, is noted. Have you tried increasing your setGameSize to a 
higher setting, so that it matches the closest zoomed in window size?

Original comment by rtaylor205@gmail.com on 25 Jul 2010 at 9:29

GoogleCodeExporter commented 8 years ago
I keep the game aspect ratio the same as the device's native one, if that's 
what you mean. So on a 480x320 screen my game size is 720x480 (I'd like to keep 
the game height fixed, for the sake of the interface).

Original comment by necrotic...@gmail.com on 25 Jul 2010 at 12:53

GoogleCodeExporter commented 8 years ago
This isn't really a "bug" as such, it's an annoying feature of OpenGL

To counter it, we will be allowing more control over how textures are loaded / 
stretched etc.

So, this report no longer needed, but thanks for the input everyone!

Original comment by rtaylor205@gmail.com on 17 Aug 2010 at 8:11