display.capture broken?

I guess my question for you would be does it happen on device? Or are you making a macOS app?

Rob

I will have to check that later…

Sorry for the very long wait…

Having run the solution and deployed to an iPhone X via Live Build I can see that the display.capture( g, { captureOffscreenArea=true } ) does work on-device.

It is just my MacBook Pro which is causing the issue.

I’m convinced that this used to work as I have lots of legacy code which uses a capture and blur effect to generate a blurred version of a display group. Suddenly, this doesn’t work.

Where the above code starts to fails is when .fill is set on one of the two objects added to the group being captured.

works fine for me using 3200

I’m on the latest daily build. Have you tried each function in the code I posted?

@sgs would love input from you on this.

Am I really the only one with this issue?

I get this

I feel like I’m taking crazy pills.

@horacebury can you put together a simple test case and zip it up and share it here?  I’ll try to give it a try, but I can’t spend the time to try and guess at your config.lua and build.settings.

Thanks

Rob

@rob Yes, definitely. Thank you.

Hi Rob,

This link is a video showing what happens on the latest daily build (3215):

https://www.dropbox.com/s/0u6f2jwazgxv9qn/displaycapture.mov?dl=0

This is the code - the second function ‘testCapture()’ demonstrates the issue:

I am running it without a build.settings or config.lua file (though I should note that the result I see is the same as in my much larger application… I can provide that if you have somewhere I can drop you a private link…)

local function testGenerateShadow() local group = display.newGroup() group.x, group.y = 400, 400 local a = display.newCircle( group, 0, 0, 100 ) a.fill = {0,1,0} local b = display.newRect( group, 0, 0, 300, 25 ) b.fill = {1,0,0} timer.performWithDelay( 1000, function() local cap = display.capture( group ) group:removeSelf() cap.x, cap.y = 200, 200 print("done") end ) end --testGenerateShadow() local function testCapture() local g = display.newGroup() g.x, g.y = 150, 150 local a = display.newRect( g, 0, 0, 100, 150 ) a.fill = {1,0,0} local b = display.newRect( g, 0, 0, 200, 100 ) b.fill = {0,0,1} local function captureWithDelay() local capture = display.capture( g ) -- g:removeSelf() capture.x, capture.y = 200, 300 end timer.performWithDelay( 2000, captureWithDelay ) end testCapture() local function captureTest() -- https://docs.coronalabs.com/api/library/display/capture.html#example local group = display.newGroup() local myObject1 = display.newRect( group, 50, 50, 100, 150 ) -- Create a rectangle object local myObject2 = display.newCircle( group, 100, 300, 50 ) -- Create a circle object myObject1.fill = {1,0,0} myObject2.fill = {1,0,1} -- group:insert( myObject1 ) -- group:insert( myObject2 ) local function captureWithDelay() -- Capture the entire group as a new display object local combined = display.capture( group ) -- Position the new display object combined.x, combined.y = 300, 300 -- Remove it timer.performWithDelay( 1000, function() group:removeSelf() combined = nil end ) end timer.performWithDelay( 1000, captureWithDelay ) end --captureTest()

What I’m asking for is a .zip file that I can download, unpack and run in the simulator and if necessary do a device or desktop build. 

This would be really helpful to me.

Also without a config.lua, then there will be possible skin or device dependencies which will make this even harder to track down.

Rob

Thanks Rob, here’s the download link:

https://www.dropbox.com/s/j6dh1hfz8z3q20m/DisplayCapture.zip?dl=0

I’ve included the video file.

You need to call display.capture like:

local combined = display.capture( group, { captureOffscreenArea=true }  )

If you want to have it capture parts of objects that are offscreen. See if that helps with your issue.

Rob

Its not that its not capturing the offscreen parts, rather that it doesn’t capture the object at all.

I’ve added the option table here:

https://www.dropbox.com/s/z1b5j1tg20jmzsl/Archive.zip?dl=0

Updated the video as well.

Another sample based more directly on my work-in-progress:

https://www.dropbox.com/s/ru18wxldsfmubhw/copy.zip?dl=0

This time I was rather surprised to see a pretty bad anomaly appear in the capture:

https://www.dropbox.com/s/0u6f2jwazgxv9qn/displaycapture.mov?dl=0

I tried both “Archive.zip” and “copy.zip” examples.  Both captured and displayed fine.  In Archive.zip, I ran each test with success.

MacBook Pro

Build: 2018.3215

Platform: iPhone / x86_64 / 10.12.6 / NVIDIA GeForce GT 750M OpenGL Engine / 2.1 NVIDIA-10.17.5 355.10.05.45f01 / 2018.3215 / en-US | US | en_US | en

…and I tried “copy.zip” on two other laptops…

Windows 10 Pro (nvidia graphics and intel integrated) w/ build 2018.3217 with no issues.

Mac OS X 10.13 (AMD R9 graphics and intel integrated) w/ build 2018.3217 with no issues.

Really don’t understand this. Just ran a different test which seems to work just fine…

w = 50 r = w/3 s = w/3 d = display.newGroup() d.x, d.y = 50, 100 display.newRect( d, 0, 0, w, w ).fill = {0,0,0} c = display.newCircle( d, 0, 0, r ) cc = display.newCircle( d, 0, 0, r ) e = display.newCircle( d, c.x+w-r, 0, r ) f = display.newCircle( d, e.x+w-r, 0, r ) c.fill = {1,1,1,.9} c.stroke = {1,0,0} c.strokeWidth = s cc.fill = {1,1,1,0} cc.stroke = {0,0,0} cc.strokeWidth = 1 e.fill = {1,1,1,.9} e.stroke = {0,0,1} e.strokeWidth = s f.fill = {1,1,1,.9} f.stroke = {0,0,1} f.strokeWidth = s print(c.width,c.height) print(cc.width,cc.height) print(d.width,d.height) local a = display.capture( d ) a.x, a.y = 50, 50

The error seen in the video of my last post makes me think there’s a problem with the GPU?

You have rebooted right?  None of us can replicate your issue so that does imply something local to you.