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 / Trouble with Tier2 SetShaderSource

Author
Message
MadBit
VIP Member
Gold Codemaster
15
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 19th May 2016 00:08 Edited at: 19th May 2016 00:10
I have the following problem. When I create and load my shader, everything works fine. As soon I put the shader source code via 'SetShaderSource' it will not work..
If I compare both shader in debug mode, the content is almost identical. Different are only 'm_iShaderID' what is so far understood and m_bFlags (in the loaded shader to hex value 0x220 in 'SetShaderSource' shader to value 0x20). I figured out that the 0x20 cause an update of the uniform variable. The 0x200 identifies a user defined shader.
What am I doing wrong? Or did I miss something?

Her some code snippet.
this work:


this doesn't work ( nothing appears on the screen )


here the real simple shader source:
vs


and ps


I hope I have described my problem understandable.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
Pixie-Particle-Engine
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 19th May 2016 14:00
The AGK_SHADER_IS_CUSTOM value needs to be set in the m_bFlags variable, otherwise AppGameKit will generate a shader to match your mesh and overwrite your shader. Unfortunately m_bFlags is protected so you would either need to hack it by loading a dummy shader (or calling MakeQuadShader) and then using SetShaderSouce to overwrite it.

Alternatively you can inherit the AGKShader class into a new class and write a function that sets the m_bFlag and then calls SetShaderSource.
MadBit
VIP Member
Gold Codemaster
15
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 19th May 2016 23:31
Ahh, many thanks. I prefer the variant of inherit. Works fine.

Thanks again.

Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
Pixie-Particle-Engine

Login to post a reply

Server time is: 2024-09-29 15:19:16
Your offset time is: 2024-09-29 15:19:16