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 / GetImage does not work for co-ordinates off the physical screen

Author
Message
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 21st Nov 2017 00:21 Edited at: 21st Nov 2017 01:00
So if my screen is 1024x760, then getImage does not work for any negative co-ordinate or any co-ordinate beyond 1024/768.
Is that correct?

My problem is i'm trying to create nibs on the fly for my doodle app. So i draw a circle and use getimage to save it. This works fine when there are no sprites on the screen but when there are it grabs them too.
Will i have to track and make all my sprites invisible to do this? Or is there another way?
Jack
20
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 21st Nov 2017 01:34
Quote: "Is that correct?"

Yes

Quote: "Will i have to track and make all my sprites invisible to do this? Or is there another way?"

Well, probably the best solution for this would be a custom pixelshader, where you can draw inside it by using GLSL.
It spares you all the custom rendering passes.

If you do not go the pixelshader way, you have to create a custom rendering pass inside the screen bounds, that will be way slower.

A good starting point for the pixelshader way would be shadertoy:
https://www.shadertoy.com/view/XsjGDt

Greetings, Jack

[/url]
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 21st Nov 2017 03:11
I figured it out! I use SetViewOffset() to shift the screen way over to the right, drew my sprites and then shifted it back.
Thanks for the link jack. I'm starting to use those evil shader things a fair bit now
Jack
20
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 21st Nov 2017 03:35
+1 for a hacky solution

I had an agk rts thread somewhere with a fog of war map draw shader for AppGameKit,
it may help you to figure out how to do shader renderings, as it draws the unit positions to a texture

RTS Thread (third download):
https://forum.thegamecreators.com/thread/218835

[/url]
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 21st Nov 2017 04:42
Thanks Jack
I'll check it out

Login to post a reply

Server time is: 2024-11-24 05:50:28
Your offset time is: 2024-11-24 05:50:28