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 / SaveImage not working with RenderImage

Author
Message
Carharttguy
7
Years of Service
User Offline
Joined: 8th Jul 2016
Location: Belgium
Posted: 23rd Jan 2018 20:35
Hello

I tried both the .png (generates empty file) or .jpg (generates black image)
Performance might be slow on a normal harddisk. I use this code to write to a RAMDisk (which is like 100x faster than a normal harddisk)


Can anybody test this? I get these results on Mac OSX.

Thanks a bunch for testing or input.
Carharttguy
7
Years of Service
User Offline
Joined: 8th Jul 2016
Location: Belgium
Posted: 23rd Jan 2018 20:45
BatVink answered this question on the chat: (Thanks BatVink!)
This problem can be solved by calling Render() first before saving!

So the code becomes:

Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 24th Jan 2018 00:10 Edited at: 24th Jan 2018 00:11
Sync() is Update(), Render(), Swap() in once

normal flow would be
clear the screen
draw into buffer (back buffer is invisible for the user), this part doing Render(), after Render call you can use DrawSprite manual if you need.
swap buffer (it just exchange the pointer where the graphics card use the pixel memory, so the back buffer is now the front buffer and visible, the front buffer will be used as backbuffer)

if you have a fullscreen opaque background sprite you not need to clear the screen because its unnecessary.
AGK (Steam) V2017.12.12 : Windows 10 Pro 64 Bit : AMD (17.12.1) Radeon R7 265 : Mac mini OS High Sierra (10.13)

Login to post a reply

Server time is: 2024-04-25 18:05:23
Your offset time is: 2024-04-25 18:05:23