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 / Doodle App/Problem with "Erase" shader on android

Author
Message
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 20th Nov 2017 01:00 Edited at: 20th Nov 2017 02:02
A bit of background;
Friend of mine lives in South Africa and is very disheartened with the state of the nation at the moment. He is painting (On the one canvas) over and over again until there is change. He has accumulated about 50+ images of this canvas as he has painted over each image.
In order to get some social media traction i offered to create an app where people could doodle over one image and it would carve down through a few of the images he has painted. Then they could share it on social media.

Some technical info;
What i am doing is this;
1. I create several "pens" of varying sizes comprising of a "dot" sprite and a "line" sprite as well as associating it with one of the abstract paintings
2. When the user swipes the screen it records the start/end position and draws a "dot" at the start and end positions and a "line" between those two points. It does this for each pen and saves the doodle for each pen in an image
3. Then using Markus/Blendo's awesome "Eraser" shader i use each pen's doodle to "erase" parts of each pens abstract image (Giving the impression of carving down through the images) you see this a as large magenta doodle
4. Now the shader, while super fast on Windows is not so quick on Android so what i did was this;
4.1 When the user swipes the screen i draw the doodle to each pens "doodle" image (Only displaying the top doodle as a sprite)
4.2 When the user lifts their finger i use the shader to erase each pens abstract image (I only erase one layer per frame to maintain performance, you will see the effect when you run the app)

My problem
This works perfectly in windows but unfortunately goes AWOL on Android

I have attached the project so you can test it if you want

Any help would be greatly appreciated

Attachments

Login to view attachments
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 20th Nov 2017 06:04
Hurrah! I solved the problem. Stoopid me.
The problem was that the code was setting the quad's shader for each render (Which i imagine would drive anyone crazy).
The Solution was to set the Quad's shader at the beginning of the program. I've attached a working (test) apk

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-11-24 06:12:18
Your offset time is: 2024-11-24 06:12:18