Skip to content

[Question] Rendering to a osg::Texture2D using OpenSceneGraph in order to do some post-processing #1356

@DeviantGames

Description

@DeviantGames

I am using QT, C++ and obviously OpenSceneGraph. More specifically, I have a C++ class that derives from QOpenGLWidget. This class contains, among other variables, these two:

osg::ref_ptr<osg::Group> m_root;
osg::ref_ptr<osgViewer::Viewer> m_viewer;

The m_root variable contains all of my geometry and is a child of m_viewer.

m_viewer->setSceneData(m_root);

The viewer is also the camera owner.

m_viewer->setCamera(create_camera(width(), height()));

As far as I know, everything is well setup. The application correctly renders my geometry to the window, which the user can access and look at. Here is how I draw to the window:

void MyClass::paintGL()
{
    m_viewer->frame();
}

I am trying to write the frame data to an osg::Texture2D instead of the screen, apply some post-processing shaders to it, and then draw that to the screen.

I have tried a lot of things so far, and none of them worked. AI does not help and the only information I found on google that talks about frame buffers or post-processing dates from 13 years ago and uses OSG 1.2. Please help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions