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 / OmG help !!! screen is flickering!!!

Author
Message
haliop
User Banned
Posted: 23rd Jul 2013 06:48 Edited at: 23rd Jul 2013 06:59
im sometimes using EnableClearColor(0) so i could get some images
but when i do this on my Asus Nexus tablet (bought it yesterday for testing) the entire screen flickers!!! what shall i do!!??!!?

haliop
User Banned
Posted: 23rd Jul 2013 06:48
on my Galaxy s4 it works flawleslly!!!

haliop
User Banned
Posted: 23rd Jul 2013 06:51 Edited at: 23rd Jul 2013 07:00
tried SetSyncRate(0,0) still flickers
tried SetSyncRate(59.9,1) still flickers
tried SetVSync(1) still flickers

im using in the main loop

Update(0)
Render()
Swap()

not using Sync()...

what shall i do?

please help.

haliop
User Banned
Posted: 23rd Jul 2013 07:04
app is due to be released in the first of August please help as quick as you can

haliop
User Banned
Posted: 23rd Jul 2013 07:16
ive also tried to put a black sprite at the highest of depth so it will be all the way back and still the same problem... what can i do
please please please help.

easter bunny
11
Years of Service
User Offline
Joined: 20th Nov 2012
Playing: Dota 2
Posted: 23rd Jul 2013 08:43
can you post some [not working] code?

haliop
User Banned
Posted: 23rd Jul 2013 08:55


on my windows pc it works great buy on my Mac it flickers
on Galaxy s4 it works great but on Asus Nexus 7 Tablet it flickers..

haliop
User Banned
Posted: 23rd Jul 2013 08:57
acutally it flickers on windows also...

Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 23rd Jul 2013 09:07 Edited at: 23rd Jul 2013 09:08
u have a double buffer,
if you paint and swap its only at one screen and the other is "empty". that flickers.
haliop
User Banned
Posted: 23rd Jul 2013 09:08
ok i found the fix... need to use swap() twice... but that is x2 slower... any other way around please?

haliop
User Banned
Posted: 23rd Jul 2013 09:11
sorry but that fix with swap() x2 dosenot work on the mobile.

Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 23rd Jul 2013 09:16 Edited at: 23rd Jul 2013 09:21
can u save two images and upload it?
SaveImage

Quote: "im sometimes using EnableClearColor(0) so i could get some images"

you mean more frames,true?
haliop
User Banned
Posted: 23rd Jul 2013 09:25
ok so far i think i have found a fix
first i draw the entire screen with the ClearScreenColor

so black for example 0,0,0

drawit and then hide it
and only then i'll start the loop .. testing it now on the Mobile

haliop
User Banned
Posted: 23rd Jul 2013 09:33
working on pc but not on Mobile... NExus 7

haliop
User Banned
Posted: 23rd Jul 2013 09:40
image when used Swap 2 times

like this:

Swap()
Render()
Swap()

at the end of the loop it works slower.

Attachments

Login to view attachments
haliop
User Banned
Posted: 23rd Jul 2013 09:41
image when used swap 1 time.

Render()
Swap()


let me remind you , that this method is much faster
and the screen was covered with sprites right away
but for some reason not all sprites were saved in the image..

Attachments

Login to view attachments
haliop
User Banned
Posted: 23rd Jul 2013 09:42
if i wont find a fix for this .. my project could be lost.. please help. what should i do?

Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 23rd Jul 2013 10:16 Edited at: 23rd Jul 2013 10:19
try this,
you have one buffer for painting in background and one in front for look at.
if you swap this both you paint in other buffer (and still in background).

haliop
User Banned
Posted: 23rd Jul 2013 11:26
but wont it takes twice as long to compute? the fps will be damnned..
and it works great on one device but on the other it dosent..

haliop
User Banned
Posted: 23rd Jul 2013 11:30
its half the speed i will now check on the mobile..

haliop
User Banned
Posted: 23rd Jul 2013 11:46
ok so your method works right on the pc and on the mac machine
but its not working on the Mobile device as i get the same results as before nly x2 slower..

Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 23rd Jul 2013 11:55 Edited at: 23rd Jul 2013 11:55
with this example before i want only show the reason.

maybe better for understanding:
after paint in both buffers it get a new random position.
haliop
User Banned
Posted: 23rd Jul 2013 12:10
that works on pc lets test on the device:


pc ok
mac - still flickering
Nexus 7 - still flickering
galaxy s4 - works great.

haliop
User Banned
Posted: 23rd Jul 2013 12:36
WHY IS the flickering happens any way?... its a bug in the system i guess...

haliop
User Banned
Posted: 23rd Jul 2013 12:36
haliop
User Banned
Posted: 23rd Jul 2013 12:41


ok so i got the problem i had still not fixed but works on Mac without flickering...
since until we reposition the sprite it stay in the same place but the colors are changed... and only then repositioning it..

but still it flickers on the mobile device..

Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 23rd Jul 2013 13:21
remember the sprite are draw allways and if it moves to the next pos.
you see the last sprite painted in (one of 2) buffer because you did not clear it.

what happens with this example?
haliop
User Banned
Posted: 23rd Jul 2013 13:50
on pc good
on mac good
on galaxy good
on Nexus 7 flickers with a grey for backgroound...

Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 23rd Jul 2013 13:56 Edited at: 23rd Jul 2013 13:57
hmmm,what happens with different agk versions?
did you try restart the Nexus 7?
haliop
User Banned
Posted: 23rd Jul 2013 14:25
why should i restart?
i use 1.0813 to do this

Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 23rd Jul 2013 14:59
if a os running for a while it can be unstable and do stupid things.
just my experience and for exclude this issue.

be sure ,all of your devices use beta 13?
maybe the 1.07 work as expected and the new 1.08 not
it can be a issue in agk.

also it can be a issue with your Nexus 7 os version.
haliop
User Banned
Posted: 23rd Jul 2013 15:15
THE nexus 7 use the same os version like the galaxy.. both are the same...

haliop
User Banned
Posted: 23rd Jul 2013 15:52
works the same with 1076... still flickers..

haliop
User Banned
Posted: 23rd Jul 2013 15:53
i cant possible relay only on galaxy market... android have too many devices this is just very very bad for me.

Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 23rd Jul 2013 17:28
The reason it flickers is because the state of the back buffer is undefined when not cleared. Some devices will give you a new piece of memory which is either random or blank, other devices will keep swapping the front and back buffer maintaining the same memory for each.

For example lets say you draw a sprite at 0,0 and swap, you then get a new back buffer and draw a sprite at 1,1. Your front buffer has a sprite at 0,0 and the back buffer has one at 1,1. When you swap now the front buffer comes back to being the back buffer whilst your back buffer goes to the screen, so now the screen is displaying the 1,1 sprite whilst the back buffer has the 0,0 sprite again. Now when you draw a sprite at 2,2 to the back buffer it contains two sprites, 0,0 and 2,2. Swap this to the screen and those two sprites become visible whilst 1,1 goes back to the back buffer. Draw at 3,3 and one buffer contains 0,0 and 2,2 and the other contains 1,1 and 3,3. So you see that swapping buffers without clearing can create flickering affect where one buffer contains half the sprites and the other contains the other half.

Not all devices swap in this manner, some will keep the contents of the back buffer after a swap, so it will always contain all the sprites, others will discard the back buffer and give you random memory (although I've never seen this method used).

In the case of the Nexus 7 I think they switched to triple buffering to make things smoother so you have three buffers containing different numbers of sprites making things more complicated.
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 23rd Jul 2013 17:56 Edited at: 23rd Jul 2013 17:58
I tested Markus' code on all my devices.

Samsung Galaxy S III (Android 4.1.1) - no flicker, but garbage lines appeared in the back over time
Philips GoGear Connect 3.2 (Android 2.3.3) - no flicker, but lots of garbage on screen
Nexus 7 (Android 4.2.2) - flickers
Toshiba 7" Thrive (Android 4.0.4) - flickers
Kindle Fire HD 7" (Android 4.0.3) - no flicker, clean and solid
iPad 2 (iOS 6.0) - no flicker
iPad 3 (iOS 6.0) - no flicker
iPod Touch (iOS 6.0) - no flicker

So, it is inconsistent behavior across Android devices.

But, if the 'EnableClearColor(0)' command is commented out, all issues disappear with all devices.

I suspect the time you might save by not letting AppGameKit clear the buffer is not worth the issues you have with odd behavior.

I should note that I did not include the SetSyncRate command in my test, I let the devices run at whatever they ran.

EDIT: Of course, the tricks you are using to fill the display by not allowing the buffer clear, that is part of your intentions, won't work without calling EnableClearColor(0). So, it is down to issues with the different devices.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 23rd Jul 2013 18:09 Edited at: 23rd Jul 2013 18:10
hmm, i use EnableClearColor(0) only if i use a full screen bg sprite
or if the screen are painted compleate with tiles.
haliop
User Banned
Posted: 23rd Jul 2013 18:14
paul ty for your response and ty ancient lady for checking it out on some devices...

i am using enableclearcolor(0) as a major part of my app
and theres just no other way around it...

the question is , can this be fixed ? in case as paul mentioned above about triple buffering ... will agk overcome this obstacle?
maybe you can offer another way of drawing a sprite or some sprites but not too many as it draws from 500 - 2000 times per frame..
(yeah on the Galaxy s4 it works flawlesly on 60 fps most of the times and gets down to 30 fps and in really hard cases it goes to about 15) but its all about tweaking and i can manage to run it smoothly..

the app is done, i have ordered an HDMI recorded with Galaxy Cable from the Galaxy to HDMI to record and make some videos before i'll release it online ...

and now i kinda like the new look of how Nexus 7 handles it but i guess not all ppl will like that..

so im guess if im talking about the Android market.. i need 2 apps
1 . demo runner - "Before Purchasing Nano 1.23 please check if your device is compitable as this is a SUPER APP"
2. Nano 1.23 - the app itself.


you know becouse of this i found a way to save a whole lot of battery power... since im using Render and Swap only when theres an action taking place while the app is running... so no more update/render/swap every frame

and yeah i dont use physics so no need for update


so actually you telling me that what needs to be done is to clear all 3 buffers in Nexus 7 ... probanbly an Nvidia Targa 3 issue.. will AppGameKit address this problem in the future paul? cause my app is completly awesome and it got a patent for Real Time Texturing system that could be applied later on ...

damn Paul.. if you'll fix this for me .. once the app will hit the market and if i'll make enough money which im sure i will.. i'll backup AppGameKit for the 5,000 $ kickstarter pledge. Word.

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 23rd Jul 2013 18:29
But isn't just the Nexus that has an issue. I identified two other brands/devices with issues. You can probably ignore the Philips GoGear. But the Toshiba 7" Thrive also had issues. And the Samsung Galaxy S III had some as well.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 23rd Jul 2013 19:00
There is a work around you could use once version 2 is ready, you could render everything to an image then render the image to the back buffer. That way it doesn't matter what happens to the contents of the back buffer since your render image will be preserved and you can continue drawing to it in the next frame.
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 23rd Jul 2013 19:14 Edited at: 23rd Jul 2013 19:22
what about using a bg sprite
and update it with the GetImage(id=spriteimageid) after render ?
maybe to slow? :-(

haliop
User Banned
Posted: 23rd Jul 2013 19:49
SUPERB! btw i wanted to support AppGameKit for the grand 5000 anyways since i got this patent working..

ok so what i'll do now is just use the flickering to create and reanimate everything... you'll see in a few days. ancient lady youre in for a treat with all of those devices and i would love if you will give me the honor of being a beta tester for me. for now its just android devices and thats a very good thing since apple got hacked a few days ago....

and paul when render to target comes along i will create the most beutiful app ever seen on computer graphics.

this idea of mine will change the way we design Virtual Worlds and Textures, everthing can be animated everything can be filled or unfilled , the only problem im having now is the use of Tier 1 without Multi threading which will make sure everything will run well. however the next versions of Nano will be on Tier 2 and only the prototyping will stay on Tier 1 since of the broad cast ability.

damn this flickring just looks awesome. its like the app is alive.

haliop
User Banned
Posted: 23rd Jul 2013 20:29
i dont use getimage at all... i am in a constant wait for render to target.

xCept
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 23rd Jul 2013 20:33
Quote: "There is a work around you could use once version 2 is ready, you could render everything to an image then render the image to the back buffer. That way it doesn't matter what happens to the contents of the back buffer since your render image will be preserved and you can continue drawing to it in the next frame."


This is excellent and something I had hoped for since the beginning. Thanks!

Login to post a reply

Server time is: 2024-05-02 12:13:07
Your offset time is: 2024-05-02 12:13:07