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 / Screenshot Function

Author
Message
Nieb
8
Years of Service
User Offline
Joined: 13th May 2014
Location: Lurking
Posted: 19th May 2022 19:10 Edited at: 4th Jun 2022 07:06
Here is an updated version of the Screenshot() function found here:
https://forum.thegamecreators.com/thread/225040#msg2648153
I'm creating this new post because that thread does not contain the word "screenshot" in the title, making it difficult to search for.


I've just noticed a built-in command called GetImage() for dumping the BackBuffer to an image. Perhaps this is something new?
It's much easier to work with, also it doesn't have issues with Draw() commands being upside-down.

Update 2022-06-04:
It appears GetImage( 0, 0, GetWindowWidth(), GetWindowHeight() ) gets confused in fullscreen and gives odd sized images.
This appears to create correctly sized images: GetImage( GetScreenBoundsLeft(), GetScreenBoundsTop(), GetScreenBoundsRight(), GetScreenBoundsBottom() )

New Version:
Carharttguy
6
Years of Service
User Offline
Joined: 8th Jul 2016
Location: Belgium
Posted: 26th Jul 2022 10:22 Edited at: 26th Jul 2022 11:05
Hello @Nieb

I tested your screenshot code but it failed to work for me. It only captures the Print statements for me, I simply created a red box, pointed the camera at the box, but the screenshot only shows the FPS meter, this is my code:


Can you confirm the same problem?

Thank you
Nieb
8
Years of Service
User Offline
Joined: 13th May 2014
Location: Lurking
Posted: 3rd Aug 2022 01:13 Edited at: 3rd Aug 2022 07:16
The object is transparent:
SetObjectColor(1, 255, 0, 0, 0) ---> SetObjectColor(1, 255, 0, 0, 255)

Now, the question is, why are we able to see it in the window? It will only go transparent, partially or fully, if SetObjectTransparency() is enabled.

Now, why/how is the transparency working with GetImage()?
Upon pondering this, I'm pretty sure the front buffer doesn't do anything with alpha, it's just RGB values for the video-out. So, all those pixels were rendered with zero alpha, but the color channels were still written as well. And that color is revealed when the buffer swap occurs.

Login to post a reply

Server time is: 2022-08-19 07:03:22
Your offset time is: 2022-08-19 07:03:22