【问题标题】:In Ogre3D, how to export texture pixel value to physical memory在Ogre3D中,如何将纹理像素值导出到物理内存
【发布时间】:2014-11-14 06:40:45
【问题描述】:

我正在使用 Ogre3D。

我有一个纹理定义为:

rtt_texture = Ogre::TextureManager::getSingleton().createManual("RttTex", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_2D, texWidth, texHeight, 0, Ogre::PF_R8G8B8, Ogre::TU_RENDERTARGET);

我正在尝试使用以下代码将其像素值复制到内存,但我得到的数据与渲染的数据不同:

unsigned char* data = new unsigned char[texWidth * texHeight * 3];
data = (unsigned char*)rtt_texture->getBuffer()->lock(0, texWidth*texHeight*3, Ogre::HardwareBuffer::HBL_READ_ONLY);

这里有错误吗?

【问题讨论】:

    标签: ogre ogre3d


    【解决方案1】:

    我发现我确实需要更换

    texWidth * texHeight * 3
    

    无处不在

    texWidth * texHeight * 4
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-02-16
      • 2017-09-01
      • 2017-06-10
      • 1970-01-01
      • 2012-01-16
      • 2019-05-02
      相关资源
      最近更新 更多