distorted graphics when using move or set loc

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

xfratboy
Posts: 97
Joined: Fri Mar 05, 2010 9:09 pm

distorted graphics when using move or set loc

Post by xfratboy » Wed Dec 05, 2018 1:52 pm

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.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9286
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: distorted graphics when using move or set loc

Post by richmond62 » Wed Dec 05, 2018 2:53 pm

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.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9578
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: distorted graphics when using move or set loc

Post by dunbarx » Wed Dec 05, 2018 3:41 pm

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

xfratboy
Posts: 97
Joined: Fri Mar 05, 2010 9:09 pm

Re: distorted graphics when using move or set loc

Post by xfratboy » Wed Dec 05, 2018 5:16 pm

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.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9286
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: distorted graphics when using move or set loc

Post by richmond62 » Wed Dec 05, 2018 5:49 pm

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.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9578
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: distorted graphics when using move or set loc

Post by dunbarx » Wed Dec 05, 2018 6:15 pm

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

xfratboy
Posts: 97
Joined: Fri Mar 05, 2010 9:09 pm

Re: distorted graphics when using move or set loc

Post by xfratboy » Wed Dec 05, 2018 7:03 pm

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.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9578
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: distorted graphics when using move or set loc

Post by dunbarx » Wed Dec 05, 2018 7:50 pm

Hmmm.

What do you see if you:

Code: Select all

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

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9286
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: distorted graphics when using move or set loc

Post by richmond62 » 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
Here's my stack
(528 Bytes) Downloaded 193 times

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9578
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: distorted graphics when using move or set loc

Post by dunbarx » Wed Dec 05, 2018 8:34 pm

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

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: distorted graphics when using move or set loc

Post by [-hh] » Thu Dec 06, 2018 2:12 am

  • 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)
shiftLock happens

xfratboy
Posts: 97
Joined: Fri Mar 05, 2010 9:09 pm

Re: distorted graphics when using move or set loc

Post by xfratboy » Thu Dec 06, 2018 3:26 am

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'

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7214
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: distorted graphics when using move or set loc

Post by jacque » Thu Dec 06, 2018 6:29 pm

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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Lagi Pittas
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 365
Joined: Mon Jun 10, 2013 1:32 pm

Re: distorted graphics when using move or set loc

Post by Lagi Pittas » Fri Dec 07, 2018 1:53 pm

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
Last edited by Lagi Pittas on Mon Dec 10, 2018 12:10 am, edited 1 time in total.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7214
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: distorted graphics when using move or set loc

Post by jacque » Fri Dec 07, 2018 4:55 pm

@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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”