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.

Newcomers AppGameKit Corner / SetobjectUVposition and sync

Author
Message
hoyoyo80
8
Years of Service
User Offline
Joined: 11th May 2016
Location:
Posted: 27th Feb 2018 06:06
Hi all,

I do some simple effect using texture plane.(somehow the animated texture shader i use before dont work suddenly)
My quest, after some trial and error the animated texture work but i have to call sync() right under SetobjectUVposition. I found my printed text is flickering do this have any drawback?

Thanks
smallg
Valued Member
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location: steam
Posted: 27th Feb 2018 09:32
Halving your frame rate.
You shouldn't need to call sync more than once per loop, make sure you aren't resetting the UV offset previously and it should be fine to update it for your effect using a single sync.
life's one big game
spec= 4ghz, 16gb ram, AMD R9 2700 gpu
hoyoyo80
8
Years of Service
User Offline
Joined: 11th May 2016
Location:
Posted: 27th Feb 2018 11:01
What? Cut the fps half? OMG...i know it is not approriate...thanks for that. As for resetting, i may need to review my code if i cannot find the fault, ill post the code here.
Thanks. Ill be back
smallg
Valued Member
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location: steam
Posted: 27th Feb 2018 18:18
depends where you sync but yes in theory, sync tells the screen to update so if you have multiple syncs it will cause weird updates and stuff won't work as expected because it may be in the wrong sync and also you have it process all the information before the first sync and then again for the 2nd... you should only use 1 per loop (flickering text is indicating you have at least 2, as for 1 sync the text is not shown, the next it is).

if you post a basic code snippet i'm sure someone can help you fix the shader.
life's one big game
spec= 4ghz, 16gb ram, AMD R9 2700 gpu
hoyoyo80
8
Years of Service
User Offline
Joined: 11th May 2016
Location:
Posted: 28th Feb 2018 01:52
Hi, i short on idea on how to go about animating via this command. My code is quite simple and to update it i use only this

My textures is 2X2, agk read the uv from top, left to right and then the next row right?

smallg
Valued Member
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location: steam
Posted: 28th Feb 2018 09:29
Ah there's your problem, for - next loops are processed in 1 frame so you won't see the updates, just the last one.
You need a simple variable increment.
Like
inc u,1
if u > 1 then u = 0
inc v,1
if v > 1 then v = 0
SetObjectUVOffset(gunfirefxmesh,0,u,v)

(Just set u and v to 0 or 1 before your main loop)
life's one big game
spec= 4ghz, 16gb ram, AMD R9 2700 gpu
hoyoyo80
8
Years of Service
User Offline
Joined: 11th May 2016
Location:
Posted: 28th Feb 2018 13:03
You're a gentleman and a scholar,smallg What u say make sense, for next is a loop within 1 frame. Ok, thanks. I got it.

Login to post a reply

Server time is: 2024-11-23 01:19:46
Your offset time is: 2024-11-23 01:19:46