Graphic tearing on animated sprites

Previous topic - Next topic

Gary

First sorry for the large attachments on this thread

I am trying to do an animated spinning coin and have it working fine on my dev pc but when I move it to another computer I get very bad graphic tearing as per the attached screen shots.

The animation is a 32 frame 187 x 189 spinning coin which I am using via

LOADANIM "coinspin.png",200,187,189

and drawing via

ROTOZOOMANIM 200,coin.frame%,coin.x,coin.y,coin.angle,coin.scale

As you can see from the screen shots the corruption is quite bad and doesnt just seem to be the graphic being cut in the wrong place. the scaling seems to be out as well

Has anyone come across anything like this before and if so how do you fix it?

Thanks
Gary

[attachment deleted by admin]

Ian Price

The following code works fine on my machine -

Code (glbasic) Select

SETCURRENTDIR("Media") // seperate media and binaries?

SETSCREEN 640,480,0

GLOBAL angle, size#

LOADANIM "coinspin.png",1,187,189

GLOBAL co[] AS Tcoin

main()


// Coin Type
TYPE Tcoin
x
y
angle
size#
dlay
anim
ENDTYPE


// Create Coin
FUNCTION create_coin: x,y,angle,size#

LOCAL c AS Tcoin

  c.x=x
  c.y=y
  c.angle=angle
  c.size#=size#

DIMPUSH co[],c

ENDFUNCTION


// Render coin
FUNCTION render_coin:

FOREACH c IN co[]

ROTOZOOMANIM 1,c.anim,c.x,c.y,c.angle,c.size#

INC c.angle

INC c.dlay

IF c.dlay>3
  INC c.anim
  c.dlay=0
ENDIF

IF c.anim>31 THEN c.anim=0

NEXT

ENDFUNCTION



// Main function
FUNCTION main:

FOR n=0 TO 50
create_coin(RND(640),RND(480),RND(360),RND(3.0))
NEXT

WHILE TRUE

render_coin()

SHOWSCREEN

WEND

ENDFUNCTION


Are you trying to display too much on an under-specced machine?
I came. I saw. I played.

Kitty Hello

it looks as if you were drawing a back/front side incorrect image and the driver interpretes that differently. It's always half a coin, right?


Gary

Ian

I have dropped it down to a single coin and it still does it.

As a debug I added a drawsprite 200,0,0 to my display code and the coins are stretched double width when I draw the whole strip so it appears that the failure is occuring on the load sprite code.

Next test is to edit the anim to be 16 x 2 wide rather than 32 x 1 incase that is causing the problem

MrTAToad

It looks like the load sizes are wrong, really - can you make the graphic available.

Gary

graphic is in the first post between the 2 screen shots

MrTAToad

#6
Ah, yes!

All those sizes seem okay on Windows (as Ian confirmed) :



I'm going to see what it's like in Virtual Box : That suffers from the problems you describe, although that is without the guest additions (as GLBasic programs just wont run with it installed).   Therefore, I suspect your graphics drivers need updating (or you need a better card :) )

This is what it looks like in Virtual Box :




[attachment deleted by admin]

Slydog

First off . . . it's looking great otherwise!   :good:

You could always try a 3d coin model overlaying your 2d scene.
Then you could also have it spin / flip / rotate anyway you wish, not just a pre-drawn animation.
(Heck, throw in Box2D and have them interact and bounce off of each other (using a 2d 'circle' collider perhaps)!)
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]

Gary

Cheers for the tips guys, I did begin to suspect the graphics card myself.

Upgrading the card is not an option unfortunately as its designed for a set spec pc which are already built up.

Tonight I am going to look to reduce the overall size of the strip down and scale it up if I need to and also try making the graphics on a 16 x 2 and 8 x 4 grid to see if that has any effect.

Slydog, I did start off thinking about using a 3d object but I suspect that there will be a bigger speed issue if I did and as its only a little used effect I just went for the basics

Will let you know the specs of the PC so others can know what to expect and hopefully how to solve it if they have the same issues

Gary

Kitty Hello

maximum texture size limit reached?

ampos

Quote from: Kitty Hello on 2011-Jun-30
maximum texture size limit reached?

Probably. On iPhone 3G it is 1024x1024, on 3GS&4 (and on my PC) it is 2048x2048
check my web and/or my blog :D
http://diniplay.blogspot.com (devblog)
http://www.ampostata.org
http://ampostata.blogspot.com
I own PC-Win, MacBook 13", iPhone 3G/3GS/4G and iPAC-WinCE

Gary

#11
I wasnt in work today but have redone the artwork as smaller widths.

I do know it can handle a 2048 wide sprite so maybe thats the limit.

Also I went to run it on my home computer which has had no problems before running it and all graphics over 1024 wide or high now are being stretched. Over 1024 wide and its double width, over 1024 high and its double height. The reason for this is because I replaced my motherboard over the weekend and never reinstalled the GFX drivers, just doing that now so that should fix it

If anyone wants to try a thinner gfx which is 100x100 per frame I have attached it

edit, see gfx below


Kitty Hello

what license is that graphics?

Gary

#13
Kitty,

If you mean who can use it then anyone on this forum can for any GLBasic program they are writing. I didn't design it myself but my cousin did for me so you could say I kind of hold the rights to it.

If you are going to use it then use the new one attached, on the last one the coin was moving to the left by 2 pixels a frame which caused glitches

Just about to try this new graphic at work now, fingers crossed :)

edit: Yay no tearing, so it looks like its a limit of 2048 x 2048 on that set up. For info its Windows XP Home SP3, an Nvidia GeForce 6200 Turbo Cache card and 512mb of ram

Thanks everyone for the help

[attachment deleted by admin]