You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
osg::ref_ptrosg::Texture::TextureObject textureObject = new osg::Texture::TextureObject(osgViewerTexture,
glfw_texture.getHandle(), GL_TEXTURE_2D);
textureObject->setAllocated();
osgViewerTexture->setTextureObject(0, textureObject);
auto testTextureObject0 = osgViewerTexture->getTextureObject(0);
auto testTextureObject1 = osgViewerTexture->getTextureObject(1);
This is just a simple way to get a pure red texture which I should be receiving, but I'm not getting any Texture objects attached to the osgViewerTexture. Any help would be greatly appreciated! Thank you!
PS the glutil class is just a wrapper of Texture2D shown by this
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hey everyone, I've been having some issues with getting a texture to display in an imgui window. Currently my set-up is looking like this,
std::vectorstd::uint8_t m_host_image_data;
m_host_image_data.reserve(4 * 1600 * 900);
for (std::size_t i = 0; i < 1600 * 900; ++i) {
m_host_image_data.push_back(255u);
m_host_image_data.push_back(0u);
m_host_image_data.push_back(0u);
m_host_image_data.push_back(255u);
}
image->setImage(1600, 900, 1, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, m_host_image_data.data(),
osg::Image::AllocationMode::NO_DELETE);
//osgViewerTexture = new osg::Texture2D();
// osgViewerTexture->setImage(image);
glfwMakeContextCurrent(glfw_window.getWindowPointer());
glutil::Texture2D glfw_texture(GL_RGBA, 100, 100, GL_RGBA, GL_UNSIGNED_BYTE, m_host_image_data.data(), false);
osgViewerTexture = new osg::Texture2D();
osg::ref_ptrosg::Texture::TextureObject textureObject = new osg::Texture::TextureObject(osgViewerTexture,
glfw_texture.getHandle(), GL_TEXTURE_2D);
textureObject->setAllocated();
osgViewerTexture->setTextureObject(0, textureObject);
auto testTextureObject0 = osgViewerTexture->getTextureObject(0);
auto testTextureObject1 = osgViewerTexture->getTextureObject(1);
This is just a simple way to get a pure red texture which I should be receiving, but I'm not getting any Texture objects attached to the osgViewerTexture. Any help would be greatly appreciated! Thank you!
PS the glutil class is just a wrapper of Texture2D shown by this
glutil::Texture2D::Texture2D(GLint internal_format, GLsizei width,
GLsizei height, GLenum format, GLenum type,
const GLvoid *data, bool generate_mipmap) {
glGenTextures(1, &m_handle);
setData(internal_format, width, height, format, type, data,
generate_mipmap);
}
Beta Was this translation helpful? Give feedback.
All reactions