How to share texture between QOpenglWidgets?

22 Views Asked by At

I have a subclass of QOpenglWidget like this:

class myOpenglWidget:public QOpenglWidget,protected QOpenGLFunctions{
public:
    void myOpenglWidget();
protected:
    void initializeGL() override;
    void paintGL() override;
    void resizeGL(int width, int height) override;
private:
    GLuint program,
           vao,
           vbo,
           texture;
};

Now I have an instance of myOpenglWidget,and draw something on the texture of this widget.Then I want to create another QOpenglWidget,and have myOpenglWidget share texture with this new QOpenglWidget.I know I should get context of myOpenglWidget and pass it to the new QOpenglWidget, but I don't know the specific steps, how can I do this?

0

There are 0 best solutions below