Alpha on overlay without CEGUI

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
zolt4n
Kobold
Posts: 32
Joined: Sun Nov 04, 2007 10:04 am

Alpha on overlay without CEGUI

Post by zolt4n »

Hello, I have a problem to set an alpha on an overlay.

My code:

Code: Select all

    
// Initialisation
_material = Ogre::MaterialManager::getSingleton().create(Name + "/default", "General");
    _container = (OverlayContainer*) OverlayManager::getSingletonPtr()->createOverlayElement("Panel", Name);
    _container->setMaterialName(_material->getName());
    _container->setPosition(xPos, yPos);
    _guiOverlay = OverlayManager::getSingletonPtr()->create(Name);
    _guiOverlay->add2D(_container);
    _guiOverlay->show();

// set picture

	_texture = TextureManager::getSingleton().load(fileName,"General");
	TextureUnitState *pTexState;
	if(_material->getTechnique(0)->getPass(0)->getNumTextureUnitStates())
		pTexState = _material->getTechnique(0)->getPass(0)->getTextureUnitState(0);
	else
       pTexState = _material->getTechnique(0)->getPass(0)->createTextureUnitState( _texture->getName() );

	 pTexState->setTextureAddressingMode(TextureUnitState::TAM_CLAMP);
	 _material->getTechnique(0)->getPass(0)->setSceneBlending(SBT_TRANSPARENT_ALPHA);


If I add
_container->setColour(ColourValue(1,1,1,0.5));

my pic is allways with an alpha = 1;

Help pleaze .........

Is it possible??
zolt4n
Kobold
Posts: 32
Joined: Sun Nov 04, 2007 10:04 am

Post by zolt4n »

i'had try somethings like that

Code: Select all

	 MaterialPtr disabledMaterial = _material;
     Ogre::Pass* p = disabledMaterial->getTechnique(0)->getPass(0);

       if( (p != NULL) && (p->getNumTextureUnitStates() >= 1) )
         {
            Ogre::TextureUnitState* tus = p->createTextureUnitState();
			tus->setColourOperationEx(Ogre::LBX_MODULATE, LBS_MANUAL,Ogre::LBS_CURRENT,Ogre::ColourValue(1,1,1,0.4), ColourValue::White, 0.5);
         }
But no result for transparency on my texture