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 / How to get the rendered screen in raw data

Author
Message
schmuck
7
Years of Service
User Offline
Joined: 29th Apr 2016
Location:
Posted: 2nd Jan 2018 07:30
Hi,

I have some post-processing methods to call after the screen renderer. I would like to know if its possible to get the final screen image in raw data, to apply my post processing and display the result to the screen (I'm using tiers2)?

Best Regards,
S.
puzzler2018
User Banned
Posted: 2nd Jan 2018 12:57
You could use getimage and read memblocks to retrieve into raw data

img = getimage(0,0,width of screen, height of screen)

memimg = creatememblockfromimage(img)

using the "memimg" grab the individual values for RGBA for each pixel and put it into a file - or depending on what you wish the raw data to be used for or saved as.

If unsure how to do this, I can take a look more when I get home from work.

but it can be done yes all depends on how you want it to be done




Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 2nd Jan 2018 15:43
i think best method are full "screen" shader for post-processing.
see also
CreateRenderImage ( width, height, format, mipmap )
SetRenderToImage ( colorImage, depthImage )
SetRenderToScreen ()
AGK (Steam) V2017.12.12 : Windows 10 Pro 64 Bit : AMD (17.12.1) Radeon R7 265 : Mac mini OS High Sierra (10.13)
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 2nd Jan 2018 15:43 Edited at: 2nd Jan 2018 15:44
Quote: "You could use getimage "

That would be far to slow realtime.

I'm pretty sure you can draw to a render target by using SetCameraToImage to be used in your fullscreen shaders before rendering to the screen.
schmuck
7
Years of Service
User Offline
Joined: 29th Apr 2016
Location:
Posted: 2nd Jan 2018 20:23
Thank you all for your prompt reply,

I will try with getImage and with SetCameraToImage (already try with CreateRenderImage, i don't know how to render a sprite on it). My target is to create a screen wrapped with physical world.

When a sprite start to go out of the screen by the right, the sprite appear at the left and the physic can be applyed on both "half sprite". To do that, I think I need some overlapped virtual screen, clone some sprite available at the border of the real screen and create a final screen with the result of the physic.

Scraggle
Moderator
20
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 2nd Jan 2018 20:32
... or
Copy the physics properties of the sprite
Move to the other side of the screen
Reapply the pysics properties

A much more simple solution that what you are trying to do
schmuck
7
Years of Service
User Offline
Joined: 29th Apr 2016
Location:
Posted: 2nd Jan 2018 20:42
Hi Scraggle,

This solution is my first try (I used 4 clones), but I had some physical conflit when the half sprite A on the right has a collision with a sprite B from the screen, and the other half sprite A on the left has a colision with another sprite C.
In this use case, I think the only solution is to use virtual screen with some overlapped area
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 2nd Jan 2018 21:40
i would use two sprites with the same image, so a sprite can move out right and the copy can move in on the left.
about collision, maybe you can use a group.
SetSpriteGroup
SetObject3DPhysicsGroupAndMask

"SetDeviceCameraToImage"
it just fill a (selfcreated) image to use the image for any sprite.
there is a example from me in online help,
https://www.appgamekit.com/documentation/Reference/Image/SetDeviceCameraToImage.htm

"CreateRenderImage"
you need set the render target with SetRenderToImage ( colorImage, depthImage )
then call Render(), the image should assigned to a sprite.
SetRenderToScreen () is the default output modus.
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 15:44:10
Your offset time is: 2024-04-25 15:44:10