setVertexShaderConstant() deprecated for matrix variable

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
afuzzyllama
Posts: 13
Joined: Thu Oct 10, 2013 2:20 am
Location: Tampa, FL

setVertexShaderConstant() deprecated for matrix variable

Post by afuzzyllama »

While working with the following code in tutorial 10*:

Code: Select all

 
core::matrix4 invWorld = driver->getTransform(video::ETS_WORLD);
invWorld.makeInverse();
services->setVertexShaderConstant("mInvWorld", invWorld.pointer(), 16);
 
The following function call:
irr::video::IMaterialRenderServices::setVertexShaderConstant()

is marked as deprecated. What is the proper way to set a matrix vertex shader constant?

* Tutorial 10:
http://irrlicht.sourceforge.net/docu/example010.html
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: setVertexShaderConstant() deprecated for matrix variable

Post by CuteAlien »

Seems you use new svn trunk. Check the tutorial 10 in there (in examples folder), but basically it's now 2 functions.
With getVertexShaderConstantID you get a register id for the shader constant. And there's a new setVertexShaderConstant which takes that id instead of a name. Note that the old solution will still work for now, it's just slower because it's using constantly string-comparisons in rendering which is rather slow while working with id's is a lot faster.
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
afuzzyllama
Posts: 13
Joined: Thu Oct 10, 2013 2:20 am
Location: Tampa, FL

Re: setVertexShaderConstant() deprecated for matrix variable

Post by afuzzyllama »

Makes sense. Thanks for pointing me in the right direction!
Post Reply