Re: [osg-users] glGetTexImage failed on Windows

31 views
Skip to first unread message

weiliang dai

unread,
Oct 28, 2010, 4:15:09 PM10/28/10
to osg-...@lists.openscenegraph.org
Hi,

I inherited some code to read back texture data. This works fine on Linux platform but seg fault on Windows. Following is the list of the code segments,

......
// create and configure the texture that we're going
// to use as target for render-to-texture (depth)
m_texture = new osg::TextureRectangle;
m_texture->setTextureSize(m_size.width, m_size.height);
m_texture->setInternalFormat(GL_RGBA32F_ARB);
m_texture->setSourceType(GL_FLOAT);
m_texture->setSourceFormat(GL_RGBA);
m_texture->setFilter(osg::Texture::MIN_FILTER, osg::Texture::NEAREST);
m_texture->setFilter(osg::Texture::MAG_FILTER, osg::Texture::NEAREST);
m_texture->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP);
m_texture->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP);

....
// receive the data every iteration
float *m_buffer = new float[m_size.width* m_size.height*4];

m_texture->getTextureObject( m_contextID )->bind();
glGetTexImage( m_texture->getTextureTarget(), 0,
GL_RGBA, GL_FLOAT, &m_buffer[0] );

The code seg fault when call to glTexImage. Did anyone have the save problem or am I
missing steps on Windows.

...

Regards,

weiliang

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

_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

weiliang dai

unread,
Oct 28, 2010, 10:11:26 PM10/28/10
to osg-...@lists.openscenegraph.org
Hi,

forget about my posting. i just find out the problem is with the allocation of the buffer. i accidentally cleared the buffer (which resize the buffer to size 0). just ignore my posting.
...

Thank you!

Cheers,
weiliang

------------------
Read this topic online here:

http://forum.openscenegraph.org/viewtopic.php?p=33211#33211

Reply all
Reply to author
Forward
0 new messages