Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: Image Tearing  (Read 1720 times)

0 Members and 1 Guest are viewing this topic.
Image Tearing
« on: November 12, 2009, 06:21:01 pm »
  • Doesn't afraid of anything.
  • *
  • Reputation: +42/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6961
I've got some..interesting image tearing problems going with the Harvest Engine.  I've ran it on multiple computers and get different results on every one of them (distortion, tiles splitting up).

Are there any articles out there I can look through the deal with this?  This is openGL btw.
Logged



i love big weenies and i cannot lie
Re: Image Tearing
« Reply #1 on: November 13, 2009, 06:21:50 am »
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3371
vsync?
Logged
Quote from: Jason
Your community is a bunch of stuck up turds.
Re: Image Tearing
« Reply #2 on: November 13, 2009, 10:20:17 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 2245
Edge clamping enabled?
Logged
Re: Image Tearing
« Reply #3 on: November 13, 2009, 03:00:08 pm »
  • Doesn't afraid of anything.
  • *
  • Reputation: +42/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6961
vsync?

Tried with vsync on and off, doesn't change anything.

Quote
Edge clamping enabled?
uhh...details nao?
Logged



i love big weenies and i cannot lie
Re: Image Tearing
« Reply #4 on: November 13, 2009, 05:43:16 pm »
  • (y)(;>.<;)(y)
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3293
Screenshots of what you're talking about may help somewhat =P (So would the rendering code but I'm not gonna ask for that because if you didn't give it originally I assume you don't want to ;P)
Logged
Re: Image Tearing
« Reply #5 on: November 21, 2009, 04:01:37 pm »
  • Doesn't afraid of anything.
  • *
  • Reputation: +42/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6961
Sorry, took forever to get this up.

As you see, the top of the tree is separated from the bottom when the screen scrolls.  The top of the tree is on a separate layer from the bottom.  My rendering code looks like this..

Code: [Select]
for (int i = 0; i < HMD.layerCount; i++)
{
                for (int j = 0; j < 2500; j++)
{
//draw the tiles skipping -1s
if (HMD.layers[i].getTileNum(j) != -1)
{
HVSTGFX::createTilePNG(HMD.layers[i].getTileNum(j), tileCoordX[j], tileCoordY[j], HMD.tileSet);
}
}
}
Logged



i love big weenies and i cannot lie
Re: Image Tearing
« Reply #6 on: November 21, 2009, 04:39:46 pm »
  • (y)(;>.<;)(y)
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3293
You sure the widths and heights of the images are right? If they're like 1 pixel off things can get a bit weird...
Logged
Re: Image Tearing
« Reply #7 on: November 21, 2009, 04:56:43 pm »
  • Doesn't afraid of anything.
  • *
  • Reputation: +42/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6961
Yes, tiles are all 16x16.  The tearing only occurs when the screen scrolls.
Logged



i love big weenies and i cannot lie
Re: Image Tearing
« Reply #8 on: November 21, 2009, 05:15:48 pm »
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3725
Hmm, is the rendering done in a separate thread from the game loop?

And does the top layer move down when scrolling up, left when scrolling right and right when scrolling left.
« Last Edit: November 21, 2009, 05:34:33 pm by Niek »
Logged

Xiphirx

wat
Re: Image Tearing
« Reply #9 on: November 21, 2009, 05:20:23 pm »
  • Xiphirx
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3006
Well, check your second layer rendering. From that screenshot it seems that it only happens on the top part of the tress...
Logged
  • For The Swarm
Re: Image Tearing
« Reply #10 on: November 21, 2009, 05:20:32 pm »
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6629
If the rendering coordinates are in float point, convert them to integers. I had the same problem a while back, that fixs it :3
Logged
Re: Image Tearing
« Reply #11 on: November 21, 2009, 05:48:08 pm »
  • Doesn't afraid of anything.
  • *
  • Reputation: +42/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6961
Hmm, is the rendering done in a separate thread from the game loop?

And does the top layer move down when scrolling up, left when scrolling right and right when scrolling left.

No, it's all the same thread.

And yes, they move in all directions.

Quote
If the rendering coordinates are in float point, convert them to integers. I had the same problem a while back, that fixs it :3
Yea, but then the coordinates get all screwed up D=

EDIT: ahh..that's interesting.  The tearing occurs on the layer that the player is being rendered on..gonna take a look through the rest of the map creation and see what's going on here.
« Last Edit: November 21, 2009, 05:52:42 pm by MG-Zero »
Logged



i love big weenies and i cannot lie
Re: Image Tearing
« Reply #12 on: November 21, 2009, 06:46:55 pm »
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3725
Hmm, is the rendering done in a separate thread from the game loop?

And does the top layer move down when scrolling up, left when scrolling right and right when scrolling left.

No, it's all the same thread.

And yes, they move in all directions.
Ah well, if it was in a different thread, than maybe it would be possible that the viewport gets updated after the bottom layer was rendered.  But if it is in the same thread, then I don't think that is the problem.
Logged
Re: Image Tearing
« Reply #13 on: November 21, 2009, 07:41:40 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 2245
How are you executing your games logic?
You're not doing it all in the same loop are you?
Logged
Re: Image Tearing
« Reply #14 on: November 21, 2009, 07:56:09 pm »
  • Doesn't afraid of anything.
  • *
  • Reputation: +42/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6961
How are you executing your games logic?
You're not doing it all in the same loop are you?

You're referring to the main loop, I assume?
Logged



i love big weenies and i cannot lie
Re: Image Tearing
« Reply #15 on: November 21, 2009, 09:43:31 pm »
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3725
How are you executing your games logic?
You're not doing it all in the same loop are you?

You're referring to the main loop, I assume?
If I am guessing right, I think Windy means. Do you update one layer, then render it and then go to next layer update that and render it and so on till you get to last layer.

That could explain why the top layer seems to shift in the opposite direction of the scrolling and why the tearing takes place in the layer that Link is on, because the viewport is updated there.

That is how you can make the multithreaded image tear in a single thread. The piece of code you gave suggests you didn't though.
« Last Edit: November 21, 2009, 09:47:10 pm by Niek »
Logged
Re: Image Tearing
« Reply #16 on: November 22, 2009, 04:42:45 pm »
  • Doesn't afraid of anything.
  • *
  • Reputation: +42/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6961
The way I'm executing the player code may relate to that.  Alright, that shouldn't be too hard to fix.  I can just use the player reference I have in the main.cpp to call the player from the proper layer after everything is drawn.
Logged



i love big weenies and i cannot lie
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.092 seconds with 56 queries.