Jump to content

  • Log In with Google      Sign In   
  • Create Account

Sharing OpenGL Buffers Across QGLWidgets


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Vincent_M   Members   -  Reputation: 749

Like
0Likes
Like

Posted 05 August 2014 - 08:02 PM

I've got multiple instances of QGLWidget running in my Qt project, and like typical GUI-related graphics programming, each of them appear to have their own context as I am able to set different clear colors once at each initialization of my QGLWidget subclasses, and they retain each frame as the frames update. This means, my engine's internal state manager designed to cut down on redundant GL calls would be invalidated since it's a static class. I can fix that by making this an instanced class, but what concerns me is how I'd manage textures. Each viewport (which also has its own GL context) will be rendering a different scene, but I want to share the models, textures and shaders across all scenes instead of loading them once per context, as I'm assuming needs to happen. Is this the case? Is there a way to share OpenGL buffer objects across multiple contexts?



Sponsor:

#2 BitMaster   Crossbones+   -  Reputation: 4442

Like
1Likes
Like

Posted 06 August 2014 - 02:38 AM

I haven't tried it out myself but according to the documentation you can pass in the QGLContext to use in QGLWidget's constructor and when you create a QGLContext you can specify another context for sharing.

Edited by BitMaster, 06 August 2014 - 02:38 AM.


#3 Vincent_M   Members   -  Reputation: 749

Like
0Likes
Like

Posted 01 September 2014 - 09:41 PM

I was looking through my posts, and realized I didn't respond back to you. I read your post when I was at the gym a weeks ago when you posted it, tried it, and it worked. You solved me issue, and it's fixed a few things. Sorry for leaving you hanging on the results. Thank you!






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS