Cant Set a "Float4" Constant (Low Level)

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
speewave
Posts: 12
Joined: Wed May 14, 2008 3:02 am

Cant Set a "Float4" Constant (Low Level)

Post by speewave »

i get this error :
Error 1 error C2664: 'bool irr::video::IMaterialRendererServices::setVertexShaderConstant(const irr::c8 *,const irr::f32 *,int)' : cannot convert parameter 1 from 'irr::video::SColorf' to 'const irr::c8 *' e:\projects\Watertest saver\Watertest\main.cpp 42 Watertest
im using this one:
setVertexShaderConstant(const irr::f32 *,const irr::s32 ,const irr::s32)

it thinks i want the High Level version but i want the low level shader version:
services->setVertexShaderConstant(video::SColorf(0.0f,0.5f,1.0f,2.0f),0,1);

(also SColorf was my replacement for a 4 float constant)
any help?
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

No, it doesn't "think you want the high level version"... You're just doing it wrong :P

Code: Select all

video::SColorf vColor(0.0f, 0.5f, 1.0f, 2.0f);
services->setVertexShaderConstant(&vColor.r, 0, 1); 
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
speewave
Posts: 12
Joined: Wed May 14, 2008 3:02 am

Post by speewave »

the shader has 4 floats (the vColor) but that counts as register c0,
&vColor.r is just for the first variable,
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

&vColor.r is just for the first variable,
Who told you that?

You're right the first snippet was slightly wrong, it should be:

Code: Select all

services->setVertexShaderConstant(&vColor.r, 0, 4); 
The last parameter is the count, which should be 4.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Post Reply