Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Box2d - PNG image physics object has visual glitch

Author
Message
SolusHunter
15
Years of Service
User Offline
Joined: 18th May 2011
Location: Kent, United Kingdom
Posted: 21st May 2011 18:15
I've been playing around with the BOX2d plugin and all the PNG images I've used for physics objects are showing an extra line from the bottom of the PNG image.

For example I have a door object which has a transparent area at the top, when this object is displayed using Box2D it has a line of the bottom of the door image repeat at the very top of the object.

If I paste the image using the normal DBPro commands the image shows corectly.

What is causing this and how can I correct it? The physics object is not rotated in any way and is in fact static, although the glitch also applies to dynamic objects.
SolusHunter
15
Years of Service
User Offline
Joined: 18th May 2011
Location: Kent, United Kingdom
Posted: 21st May 2011 19:00
Worked it out. It looks like Box2D plugin doesn't like odd number width and heights on the objects image.

My door was 423 pixels high and caused what looks like a wrap around glitch. By changing the PNGs height to 424 the object displays correctly.
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 21st May 2011 19:40
Never seen this issue, I'd say maybe a screenshot and copy of the image would help. Diggsey is very quick to try to solve bugs but some more info will help.

SolusHunter
15
Years of Service
User Offline
Joined: 18th May 2011
Location: Kent, United Kingdom
Posted: 21st May 2011 20:01 Edited at: 21st May 2011 20:35
Attached is a screengrab (partial) showing the glitch at the top of the PNG when used via Box2D.

I'll post the original PNG in a second.

Using the latest version of Box2D (downloaded last week), and DarkBasic Pro 1.071 U77 rc7 (for Windows 7 SP1 support).


DarkBasic Pro 1.071 U77RC7
Windows 7 x64
SolusHunter
15
Years of Service
User Offline
Joined: 18th May 2011
Location: Kent, United Kingdom
Posted: 21st May 2011 20:02
Here's one of the PNG images that causes the glitch at the top.

Hope it helps.
BatVink
Moderator
23
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 21st May 2011 20:42
I've seen this problem too a few times, although its disappeared from my current project. I have around 25 images and none of them have the issue, the law of averages says there must be a few odd-numbered image heights in there.

SolusHunter
15
Years of Service
User Offline
Joined: 18th May 2011
Location: Kent, United Kingdom
Posted: 21st May 2011 22:13
It's seems to be one of those things that comes up from time and time. I thought it wouldn't matter these days. Looks like I was wrong


DarkBasic Pro 1.071 U77RC7
Windows 7 x64
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 21st May 2011 23:24
Have you tried loading your images with the texture flag set to 1?

SolusHunter
15
Years of Service
User Offline
Joined: 18th May 2011
Location: Kent, United Kingdom
Posted: 22nd May 2011 11:28
Just tried your suggestion about setting the texture flag to 1, sadly, it didn't change anything.

I suspect it must be because the image is handled by the plugin and not the normal DBPro method.


DarkBasic Pro 1.071 U77RC7
Windows 7 x64
Diggsey
20
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 22nd May 2011 12:34
I've fixed it for the next update of Box2D. For now, I suggest you just add a row of transparent pixels to the bottom of the image.

[b]
SolusHunter
15
Years of Service
User Offline
Joined: 18th May 2011
Location: Kent, United Kingdom
Posted: 22nd May 2011 12:35
Superb Many Thanks.

I'm really enjoying developing with Box2D.

DarkBasic Pro 7.7 U77RC7
Windows 7 x64
BatVink
Moderator
23
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 22nd May 2011 19:32
Just spotted 2 things...

1. One of my images still has the "line", so I do need the upcoming fix too.

2. I just played the Chrome version of Angry Birds - and it has lines above images :0

Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 22nd May 2011 19:42
Quote: "2. I just played the Chrome version of Angry Birds - and it has lines above images"

lol, I haven't noticed that yet but now I have to go look.

Login to post a reply

Server time is: 2026-07-11 19:06:12
Your offset time is: 2026-07-11 19:06:12