Page 1 of 3

distorted graphics when using move or set loc

Posted: Wed Dec 05, 2018 1:52 pm
by xfratboy
I asked a question to the forum a few years ago and never found a solution. I'm wondering if there's any new advice.. Basically, I'm moving a graphic from one side of the screen to another via a repeat loop until a stop command is issued to the repeat. If the graphic is moving very slowly it looks ok, but if I make it move fast then the graphic gets distorted. Basically, a round shape graphic turns into partially round shape with one side flattened out. Literally nothing I've tried fixes it.. some fixes tried unsucessfully:
- set acceleratedrendering to true
- set layermode of the graphic to dynamic
-tried using the set loc method vs the move method
- tried modifying the syncrate to no avail
- tried it on several different windows machines and the problem is somewhat consistent...some computers are worse than others.

Re: distorted graphics when using move or set loc

Posted: Wed Dec 05, 2018 2:53 pm
by richmond62
It is not clear whether you are moving a GRAPHIC or an IMAGE,

and it is not clear HOW you are moving it.

If you could explain these that would make any attempt at answer rather easier.

Re: distorted graphics when using move or set loc

Posted: Wed Dec 05, 2018 3:41 pm
by dunbarx
What Richmond said.

I assume you mean "graphic' when you say "graphic"

If I were much younger, and using 1980's-style thinking, I would try this in a button:

Code: Select all

on mouseUp
   set the loc of grc 1 to "100,200"
   
   repeat 200
      set the loc of grc 1 to (item 1 of the loc of grc 1) + 1 & ",200"
      wait 1
   end repeat
end mouseUp
The circle moves smoothly without distortion.

So what Richmond means is, what are you doing?

Craig Newman

Re: distorted graphics when using move or set loc

Posted: Wed Dec 05, 2018 5:16 pm
by xfratboy
Sorry for the lack of details. I'm referring to grc or img objects. Both perform the same. I've also taken your script exactly as you wrote it, and placed within a new stack, and I get the same results. The edge of the graphic that is in the direction of the movement (ie the right side of the grc) flickers and distorts. I should also note, that this problem started around the days of Windows 8. I assume something changed in the MS environment that changed the way resources are utilized.

Re: distorted graphics when using move or set loc

Posted: Wed Dec 05, 2018 5:49 pm
by richmond62
There seem to be a number of variables there apart from LiveCode itself:

Your computer's processor.

Your computer's graphic card.

How those interact with the version of Windows you have installed on your computer.

It might not be a bad idea to run the stack on a more up-to-date machine and see if
the same problem persists.

Re: distorted graphics when using move or set loc

Posted: Wed Dec 05, 2018 6:15 pm
by dunbarx
I've also taken your script exactly as you wrote it, and placed within a new stack, and I get the same results.
I am on a Mac. Ahem.

Anyway, that little handler, with a simple circular grc, distorts along its path? What happens if you:

Code: Select all

on mouseUp
   set the loc of grc 1 to "100,200"
   
   repeat 100
      lock screen
      set the loc of grc 1 to (item 1 of the loc of grc 1) + 1 & ",200"
      wait 1
      unlock screen
   end repeat
end mouseUp
Craig

Re: distorted graphics when using move or set loc

Posted: Wed Dec 05, 2018 7:03 pm
by xfratboy
Craig. Thank you for your reply. Yes, it distorts along the path. No change with the lock/unlock commands. I should say, this is not just on my computer or environment. I've tested on numerous machines..some do it and some do not. Macs not as profound as PC's. The faster the movement, the more profound the distortion. I thought I read somewhere that Windows downgraded 2d graphics resources.. out of my pay grade.

Re: distorted graphics when using move or set loc

Posted: Wed Dec 05, 2018 7:50 pm
by dunbarx
Hmmm.

What do you see if you:

Code: Select all

  move grc 1 from "100,200" to "500,200" in 100
Craig

Re: distorted graphics when using move or set loc

Posted: Wed Dec 05, 2018 8:06 pm
by richmond62
Pretty clunky "over here" on 64-bit Linux (LC 9.0.1), and a sort of flashing effect at the leading edge.
distort.livecode.zip
Here's my stack
(528 Bytes) Downloaded 22 times

Re: distorted graphics when using move or set loc

Posted: Wed Dec 05, 2018 8:34 pm
by dunbarx
Using the "move" option (the one that should be used) I get a smooth motion.

Using the loop, I get a handful of successively faster "moves", until the overall speed stabilizes. If I change the handler at all, the process starts over.

Apparently, LC catches on to what I am up to, and grudgingly falls into line.

Craig

Re: distorted graphics when using move or set loc

Posted: Thu Dec 06, 2018 2:12 am
by [-hh]
  • On windows try
    set the lowResolutionTimers to true
  • Also try in the line before "move"
    lock messages
  • Draw a polygon instead of using a "regular" style of the graphic.
    Regular polygons are clipped if the linesize increases.
    (Bug reported long ago)

Re: distorted graphics when using move or set loc

Posted: Thu Dec 06, 2018 3:26 am
by xfratboy
richmond62 wrote:
Wed Dec 05, 2018 8:06 pm
Pretty clunky "over here" on 64-bit Linux (LC 9.0.1), and a sort of flashing effect at the leading edge.

distort.livecode.zip
Yep. That's what I see. Flashing effect on the leading edge is a better description than what I wrote. Setting the 'lowResolutionTimers to true' didn't change anything nor did the 'lock moves'

Re: distorted graphics when using move or set loc

Posted: Thu Dec 06, 2018 6:29 pm
by jacque
I'd report this as a bug just to see if the team can fix it, but it sounds to me like the graphics card can't keep up with the required redraws. Since moving the control slower fixes the problem, that's probably the solution for now. Also, as suggested, you should be using the "move" command which is optimized for this. You can adjust the moveSpeed to find the speed that best eliminates the problem. Also do use acceleratedRendering and set the object's layermode to dynamic.

Re: distorted graphics when using move or set loc

Posted: Fri Dec 07, 2018 1:53 pm
by Lagi Pittas
Hi

I would suggest it's the driver. If it works on some machines and not others.

When you install windows on a machine that you do not have the latest graphic driver to it uses a "generic" vga Driver. If the OP has updated to Windows 10 from say a windows 7 machine then W10 will put in a generic driver.

In the Old days (sigh....) you could see a smallish window with just text inside distort when dragging never mind a graphic (although a window is a graphic -YKWIM)

Lagi

Re: distorted graphics when using move or set loc

Posted: Fri Dec 07, 2018 4:55 pm
by jacque
@Lagi, you're probably right, as a Mac user I never need to update drivers manually so I forget about those. But back in the Old Days, the first thing always suggested for graphic issues was to update the driver.