I've seen several topics on the forum which talk about that... but which didn't solve the problem. It seems that the shader's parameters are not serialized in the .material file generated.
A topic talks about a patch which have been created which solves this problem, but the only file this topic gives is a zip file (patch.zip) containing a .inc and a .txt file with no code in it.
I've downloaded the very last version of Ogre SDK (12/11/06), rebuilt my programs and still get the same problem....
It would be very nice if you could help me please !
Here is my code :
Code: Select all
MaterialPtr mat = MaterialManager::getSingleton().create(matName, ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
mat->load();
Pass* pass0 = mat->getTechnique(0)->getPass(0);
pass0->setAlphaRejectSettings(CMPF_GREATER_EQUAL, 127);
pass0->setFragmentProgram("Ogre/BasicVertexPrograms/AmbientOneTexture2"); // a small modification of the original ambient shader to handle transparent textures
Ogre::GpuProgramParametersSharedPtr fpConsts = pass0->getFragmentProgramParameters();
fpConsts->setNamedAutoConstant("sceneAmbient", Ogre::GpuProgramParameters::ACT_AMBIENT_LIGHT_COLOUR);
pass0->setFragmentProgramParameters(fpConsts);
TextureUnitState *tex = pass0->createTextureUnitState(name,0);
tex->setColourOperation(LBO_REPLACE);
pass0->_load();
// [...] same kind of code with other passes
Pass* pass1 = mat->getTechnique(0)->createPass();
// [........]
mat->setCullingMode(CULL_CLOCKWISE);
mat->compile();
submesh->setMaterialName( matName );
// then saving of the material
MaterialSerializer mats;
mats.queueForExport(mat);
// then queues other materials
mats.exportQueued("test.material", true);
Code: Select all
fragment_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture2
{
}
A topic talks about fpConsts->addConstantDefinition(...) but I didn't understand how to use it...
Lots of thanks !
Nicolas