Pieron
16-09-2008 21:44:02
Hello. I'm totally newbie in OGRE and 3d graphics programming
For now, I making editor and i get texture issue, when the terrain material is created dinamically
My render is OpenGL, Linux, OGRE 1.6.0RC1.
If i'm using pre-existing material (ETTerrain) material showed correctly.
I'm guess, this is not texture loading issue - if i'm using single texture for material (without splatting manager) - everything is fine.
My code is:
Just trying create demo material, but dynamically, nothing more.
Screen:
Ogre.log is clean (no errors)
Thanks for any help and sorry for my bad english ^_^
For now, I making editor and i get texture issue, when the terrain material is created dinamically
My render is OpenGL, Linux, OGRE 1.6.0RC1.
If i'm using pre-existing material (ETTerrain) material showed correctly.
I'm guess, this is not texture loading issue - if i'm using single texture for material (without splatting manager) - everything is fine.
My code is:
mSplattingManager = new ET::SplattingManager("ETSplatting","ET",128,128,3);
mSplattingManager->setNumTextures(6);
Ogre::MaterialPtr material = Ogre::MaterialManager::getSingleton().getByName("TerrainMaterial");
material->removeAllTechniques();
Ogre::Technique * mainTech = material->createTechnique();
Ogre::Pass * pass = mainTech->createPass();
pass->setLightingEnabled(false);
pass->setVertexProgram("ET/Programs/VSLodMorph2");
pass->setFragmentProgram("ET/Programs/PSSplat2");
pass->_load();
pass->getFragmentProgram()->setParameter("splatScaleX","20");
pass->getFragmentProgram()->setParameter("splatScaleZ","20");
Ogre::TextureUnitState * texture_unit = pass->createTextureUnitState();
texture_unit->setTextureName("ETSplatting0");
texture_unit = pass->createTextureUnitState();
texture_unit->setTextureName("ETSplatting1");
texture_unit = pass->createTextureUnitState();
texture_unit->setTextureName("splatting0.png");
texture_unit = pass->createTextureUnitState();
texture_unit->setTextureName("splatting1.png");
texture_unit = pass->createTextureUnitState();
texture_unit->setTextureName("splatting2.png");
texture_unit = pass->createTextureUnitState();
texture_unit->setTextureName("splatting3.png");
texture_unit = pass->createTextureUnitState();
texture_unit->setTextureName("splatting4.png");
texture_unit = pass->createTextureUnitState();
texture_unit->setTextureName("splatting5.png");
mTerrainManager->setMaterial(material);
Just trying create demo material, but dynamically, nothing more.
Screen:
Ogre.log is clean (no errors)
Thanks for any help and sorry for my bad english ^_^