-
I try to use // in one of camera preDrawCallback
osg::ref_pte<osg::Texture2D> color_buffer;
void operator()(osg::RenderInfo& renderInfo) const override
{
...
double current_viewer_width = ...//Get current viewer windows width
double current_viewer_height = ...//Get current viewer windows height
color_buffer->setTextureSize(current_viewer_width, current_viewer_height );
// color_buffer->dirtyTextureObject(); // I try to dirty this texture, but it doesn't work.
} How to resize the |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
I don't recall the details as it's over 5 years since I worked on the OSG, but GPUs don't like changing sizes of resources, they work best when you allocate a texture/framebuffer etc. at a fixed size for the life of the application. If you want to change the size you need to reallocate that resource. The is the same for OpenGL/OpenSceneGraph as it is for Vulkan/VulkanSceneGraph. In the case of "resizing" textures the most efficient route is to allocate to the largest size you need then if you don't need to whole extents use a smaller a viewport to it, and adjust the texgen/texcoords when reference it. |
Beta Was this translation helpful? Give feedback.
-
Have a look at osgverse (https://github.com/xarray/osgverse). |
Beta Was this translation helpful? Give feedback.
camera->resizeAttachments() should do the trick, as I remember.
PS: yes we can speak Chinese in wechat groups or somewhere else, but not suitable in a public issue. :)