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.

AppGameKit Classic Chat / Bug with get image?

Author
Message
Rich Dersheimer
AGK Developer
17
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 4th Dec 2013 17:52 Edited at: 4th Dec 2013 17:59
I can't seem to get GetImage() to grab my whole screen side-to-side. Well, it might be grabbing the whole screen, but the pixels I've drawn are not showing up.

This draws a grid on the whole screen, then grabs it as an image, then assigns the image to a sprite.



But this is the result:



It seems to only grab the pixels from the "middle half" of the screen, but it's only missing the horizontal sections, it's grabbing the vertical fine. I've tried different resolutions, same thing happens.

This shows that the pixels ARE actually being drawn.


Any thoughts?

Naphier
15
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 4th Dec 2013 20:54
Yeah, nothing has been drawn to the screen at the time you are calling GetImage.
Try adding render() before GetImage() and it should work
You also might want to call ClearScreen before render
here's a working example of the usage
http://forum.thegamecreators.com/?m=forum_view&t=208205&b=41&msg=2490505#m2490505

Ancient Lady
Valued Member
22
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 4th Dec 2013 21:27
Definitely, ClearScreen() then Render() before GetImage().

The ClearScreen() makes sure that stuff doesn't get left over.

And Render() is needed, even though Sync() does do a Render phase. Sync() by itself doesn't do the trick.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Rich Dersheimer
AGK Developer
17
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 4th Dec 2013 21:51 Edited at: 4th Dec 2013 22:04
ClearScreen() before drawing the lines fixed it up. I didn't even have to use Render(), it works fine without it.

Thanks for the help!

EDIT: LOL! Putting a Sync() at the top of the code fixes it as well. Not a big surprise, since sync does both a clear and render. It's funny that putting it BEFORE the drawline commands fixes the problem though. If I was trying to grab sprites or text, I would probably HAVE to use the Render() after all the pieces are in place.

MORE EDIT: Putting any of the three commands at the top of the code fixes the problem. Might be related to the way you have to use sync() twice sometimes to get good results. *shrug*

Marl
14
Years of Service
User Offline
Joined: 19th Nov 2011
Location: Bradford, UK
Posted: 5th Dec 2013 02:02
Yeah, you should always do a Sync() after setting resolution to lock it in.

I've had similar issues with sprite sizes from the same cause.

Login to post a reply

Server time is: 2026-07-17 17:09:55
Your offset time is: 2026-07-17 17:09:55