Hi,
could you explain what the texgen is for?
You could also try osg::TexEnv::DECAL instead of BLEND. This should make
the bottom texture appear in all transparent regions. You might have to
set a border with 0 alpha for the mask texture depending on the tex
coordinates generated.
jp
On 01/03/11 12:07, Petr Srom wrote:
Hi,
i would like to apply 2 textures on the same quad,
2nd texture is type format of ".inta" with alfa channel.
Could you help me how o set these textures to correct mixing on the same quat?
First image is my solution of correct texturing on the quad.
[Image: http://www.imgshare.cz/images/multiplete.jpg ]
Second image is screenshot from viewer.
[Image: http://www.imgshare.cz/images/multipeie.jpg ]
osg code:
create - screenQuad;
init - sourceSceneTexture (osg::Camera::PRE_RENDER)
init - mirrormask1 (.inta file)
osg::StateSet *quadState = quadGeode->getOrCreateStateSet();
quadState->setTextureAttributeAndModes(0, sourceSceneTexture,
osg::StateAttribute::ON|osg::StateAttribute::PROTECTED);
osg::TexGen* texgen = new osg::TexGen;
texgen->setMode(osg::TexGen::SPHERE_MAP);
osg::TexEnv* texenv = new osg::TexEnv;
texenv->setMode(osg::TexEnv::BLEND);
texenv->setColor(osg::Vec4(1.0f,1.0f,1.0f,1.0f));
quadState->setTextureAttributeAndModes(1, mirrormask1, osg::StateAttribute::ON);
quadState->setTextureAttributeAndModes(1, texgen, osg::StateAttribute::ON);
quadState->setTextureAttribute(1,texenv);
//prerender camera
osg::ref_ptr<osg::Camera> textureCamera = new osg::Camera;
...
//ortho camera
osg::ref_ptr<osg::Camera> orthoCamera = new osg::Camera;
orthoCamera->setProjectionMatrix(osg::Matrix::ortho2D(0,
ms_setupview.vi[i].width, 0, ms_setupview.vi[i].height));
orthoCamera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
orthoCamera->setViewMatrix(osg::Matrix::identity());
orthoCamera->setViewport( ... );
orthoCamera->setRenderOrder(osg::Camera::POST_RENDER);
Thank you!
Cheers,
Petr
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=37197#37197
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
--
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard.
The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.
This message has been scanned for viruses and dangerous content by MailScanner,
and is believed to be clean. MailScanner thanks Transtec Computers for their support.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org