[osg-users] Loading a SilverLining environment map into an OpenSceneGraph texture

Chris Hardy hardyc02 at gmail.com
Thu Feb 15 06:51:41 PST 2018


It turns out this is pretty easy, I just made a couple of silly uncaffeinated mistakes. In case anyone gets stuck in the same hole, all you have to do is create your own TextureObject and assign it to the TextureCubeMap.

Perhaps there are some finer details missing in this solution but the output on the screen is at least accurate to what I want for the moment.


Code:

unsigned int handle;
void* ptr = &handle;
atm->GetEnvironmentMap(ptr, 6);

osg::TextureCubeMap* hdrEnvMap = new osg::TextureCubeMap;
osg::Texture::TextureObject* textureObject = new osg::Texture::TextureObject(hdrEnvMap, (GLuint)ptr, GL_TEXTURE_CUBE_MAP);
hdrEnvMap->setTextureObject(camera->getGraphicsContext()->getState()->getContextID(), textureObject);




My reflections are the wrong way around but that's my own problem I suppose. :P

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=72962#72962



-------------- next part --------------
A non-text attachment was scrubbed...
Name: silverlining_envmap.png
Type: image/png
Size: 496336 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20180215/6a65071f/attachment-0001.png>


More information about the osg-users mailing list