开发者

Sharing a VBO across multiple QWidgets in JOGL

开发者 https://www.devze.com 2023-03-01 00:29 出处:网络
I\'m trying to share create four QGLWidgets with the same GL3 context so I can sha开发者_如何转开发re a VBO between them.I\'ve been doing this for a while with just one widget, but it wasn\'t shared w

I'm trying to share create four QGLWidgets with the same GL3 context so I can sha开发者_如何转开发re a VBO between them. I've been doing this for a while with just one widget, but it wasn't shared with the others. QGLWidget has a sharewith paremeter, which from what I understand automatically shares the contexts between them, but I'm not sure how compatible that is with JOGL.

I'm also confused about when the context is actually created. In some examples it says to create the context in initializeGL. I'm not sure if that means I have to update the first widget before I can create the secondary widgets (passing the sharewith paremeter the first created widget with a current context).

Can anyone provide me with a simple example to get this functioning? I just need to create four context-sharing GLWidgets that all run off a GL3 profile.


Although I'm not using JOGL, I am doing a similar thing here and here. The basic idea is that you create a hidden QGLWidget, make it current and compile all your shaders, then pass it as the shareWidget to your child viewports. Whenever you want to upload geometry make the hidden QGLWidget current and do your glBufferData calls - the data becomes available to the other viewport contexts.

0

精彩评论

暂无评论...
验证码 换一张
取 消