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 / [SOLVED] Trouble saving a screenshot.

Author
Message
Carharttguy
7
Years of Service
User Offline
Joined: 8th Jul 2016
Location: Belgium
Posted: 25th Jul 2022 20:17
Hello

I want to load 3D objects, move the camera above it, take a screenshot and write an image.
So far everything works, except for taking a screenshot and exporting it. The image is always blank.
I read the documentation here: https://www.appgamekit.com/documentation/Reference/Image/GetImage.htm

So, this is the relevant code:



I promptly see the object (as expected, As Swap() is called before End())
If I comment out the GetImage and SaveImage lines, the objects is shown perfectly.

What is wrong with the code here?

Thanks for any help!

The author of this post has marked a post as an answer.

Go to answer

pavel_sv_1982
11
Years of Service
User Offline
Joined: 9th Apr 2013
Location: Russia
Posted: 26th Jul 2022 00:00
Try this.
programming is a hobby, not a job.
Carharttguy
7
Years of Service
User Offline
Joined: 8th Jul 2016
Location: Belgium
Posted: 26th Jul 2022 10:24
Hi pavelman

Can you elaborate a bit more? The documentations contradicts your advice as the command is deprecated and seems to be for capturing a device camera rather than a screenshot of the rendered screen?

Thank you!
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 26th Jul 2022 12:42
Quote: "this is the relevant code:"

i think there's more going on but check out this thread
pavel_sv_1982
11
Years of Service
User Offline
Joined: 9th Apr 2013
Location: Russia
Posted: 26th Jul 2022 13:50 Edited at: 26th Jul 2022 14:32
delete Update(0)
and change swap() -> Sync()

programming is a hobby, not a job.

Attachments

Login to view attachments
Carharttguy
7
Years of Service
User Offline
Joined: 8th Jul 2016
Location: Belgium
Posted: 26th Jul 2022 16:29
Thanks Virtual Nomad and pavelman.

I'm getting somewhat closer, when I omit the SetObjectColor() command the code works as expected.
@pavelman: Switching Swap() -> Sync() doesn't make a whole lot of difference because Sync() does a Swap(). I have deleted update() from the code.

So, this works, uncomment the SetObjectColor line and the image is empty. I have no idea why this is happening. Is this a bug, or is this perfectly explainable? Either way, does anyone knows how to take a screenshot with a object colors instead of textures?
Carharttguy
7
Years of Service
User Offline
Joined: 8th Jul 2016
Location: Belgium
Posted: 26th Jul 2022 20:16
This post has been marked by the post author as the answer.
AFter lots of testing I have found the solution:

I was setting the ObjectColor with Alpha 0, in normal rendering, the color is rendered normally (I actually don't know why, it should be transparant I think?)
But with the GetImage function it is applied and the whole object is transparant, even with objectalpha untouched.

It seems odd to me that the object is displayed differently on different outputs, I don't know if it's a bug or expected, but either way, If I set the Alpha to 255 the Image is as expected.

Thanks for all help!

Login to post a reply

Server time is: 2024-04-26 02:25:47
Your offset time is: 2024-04-26 02:25:47