Can anyone help me with loading 6 hdr images into a cubic texture? The code
below seems to work, but the images are sort of crazy anywhere the value of the
colors is greater than one. I'm guessing that somehow I'm messing up the pixel
format, but I can't figure it out.
Code:
osg::TextureCubeMap* mTexture;
osg::Image* mImage00 = ODTWTextureManager::GetPtr()->ReadImageFile(name
+ "_c00" + type);
osg::Image* mImage01 = ODTWTextureManager::GetPtr()->ReadImageFile(name
+ "_c01" + type);
osg::Image* mImage02 = ODTWTextureManager::GetPtr()->ReadImageFile(name
+ "_c02" + type);
osg::Image* mImage03 = ODTWTextureManager::GetPtr()->ReadImageFile(name
+ "_c03" + type);
osg::Image* mImage04 = ODTWTextureManager::GetPtr()->ReadImageFile(name
+ "_c04" + type);
osg::Image* mImage05 = ODTWTextureManager::GetPtr()->ReadImageFile(name
+ "_c05" + type);
cout << " Image 5 format: " << mImage05->getInternalTextureFormat() <<
endl;
mTexture = new osg::TextureCubeMap();
mTexture->setClientStorageHint(true);
mTexture->setImage(osg::TextureCubeMap::POSITIVE_X,mImage00);
mTexture->setImage(osg::TextureCubeMap::NEGATIVE_X,mImage01);
mTexture->setImage(osg::TextureCubeMap::POSITIVE_Y,mImage02);
mTexture->setImage(osg::TextureCubeMap::NEGATIVE_Y,mImage03);
mTexture->setImage(osg::TextureCubeMap::POSITIVE_Z,mImage04);
mTexture->setImage(osg::TextureCubeMap::NEGATIVE_Z,mImage05);
cout << " Cube format: " << mImage05->getInternalTextureFormat() <<
endl;
mTexture->setWrap(osg::Texture2D::WRAP_S,osg::Texture2D::CLAMP_TO_EDGE);
mTexture->setWrap(osg::Texture2D::WRAP_T,osg::Texture2D::CLAMP_TO_EDGE);
osg::Uniform* mUniform = new osg::Uniform(inSampler.c_str(),inTexunit);
mCurrentMaterial->addUniform(mUniform);
mCurrentMaterial->setTextureAttributeAndModes(inTexunit,mTexture);
thanks!
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=9504#9504
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org