bool shader constants are not transmitted

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Christi258
Posts: 62
Joined: Wed Feb 06, 2013 12:11 pm

bool shader constants are not transmitted

Post by Christi258 »

Hi all,
i have 5 bool variables in my shader. the first 2 of them work properly. But the other 3 are not correctly in my shader. I can change them how i want, they always have the same value:

Code: Select all

 
bool settings[PG_COUNT];
...
services->setVertexShaderConstant("en_projected_grid", &settings[PG_ENABLE_PROJECTED_GRID], 1);
services->setVertexShaderConstant("en_displacement", &settings[PG_ENABLE_DISPLACEMENT], 1);
services->setVertexShaderConstant("en_refraction", &settings[PG_ENABLE_REFRACTION], 1);
 
services->setPixelShaderConstant("en_reflexion", &settings[PG_ENABLE_REFLEXION], 1);
services->setPixelShaderConstant("en_specular_lighting", &settings[PG_ENABLE_SPECULAR_LIGHTING], 1);
 
Is there a maximum of constants defined, or is that a bug?
PS: I use shader 3.0
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: bool shader constants are not transmitted

Post by CuteAlien »

Afaik there is no setVertexShaderConstant for boolean values. Which means they probably get casts to int. Which depending on the compiler and platform do not have the same size and so would get wrong values. Try using int's, maybe it works then.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply