Jump to content
  • Advertisement
Sign in to follow this  
SteveDeFacto

Are buffers created with glGenBuffersARB bound to the current context?

This topic is 2781 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm writing an API and I need to render to user created windows. I'm having a problem where if I create another window and context my program will crash when I try to render buffers that were created while another context was current. I can only assume this is because the buffers are bound to the context that was current at the time. If this is the case then how do I create a vertex or index buffer that is independent of the context?

Share this post


Link to post
Share on other sites
Advertisement
Everything in OpenGL operates on, and is bound to, the current context. Look up context sharing if you need to share buffers between contexts. This, however, is outside OpenGL and is tied to the glue layer for your specific platform (wgl for Windows for example), and does really not change that resources are bound to contexts. You cannot make global resources not tied to any context in OpenGL.

You're not giving very specific descriptions of your setup, so can only give you a general hint; consider if using a single context for all windows is working for you.

Share this post


Link to post
Share on other sites
The answer is quite simple: Create sharing context group, and all buffers created in one of them can be accessed from the others.
What version of OpenGL are you using, and on which OS? Answers to these questions enables more precise and concrete hints. ;)

Share this post


Link to post
Share on other sites
If you are on Windows
http://www.opengl.org/wiki/Platform_specifics:_Windows#wglShareLists

Share this post


Link to post
Share on other sites

If you are on Windows
http://www.opengl.or...s#wglShareLists


wglShareLists() is deprecated approach. Further more it doesn't work any more. I've already mentioned that share group is the only valid way to deal with sharing on GL 3.0+ contexts. That's why I ask for more details about the OS and GL version. It's about the time to update Wiki on OpenGL.org. ;)

Share this post


Link to post
Share on other sites

[quote name='V-man' timestamp='1304353895' post='4805529']
If you are on Windows
http://www.opengl.or...s#wglShareLists


wglShareLists() is deprecated approach. Further more it doesn't work any more. I've already mentioned that share group is the only valid way to deal with sharing on GL 3.0+ contexts. That's why I ask for more details about the OS and GL version. It's about the time to update Wiki on OpenGL.org. ;)
[/quote]

What the heck is a share group? :)
I'll update it when and if I learn something new.

Share this post


Link to post
Share on other sites

What the heck is a share group? :)
I'll update it when and if I learn something new.


Should I teach you? :cool:


I really doubt it is necessary. Well, in shot, sharing should be defined at context creation time. Take a look at WGL_ARB_create_context spec, or more precisely at function:

HGLRC wglCreateContextAttribsARB(HDC hDC, HGLRC hshareContext, const int *attribList);


The second parameter is a rendering context handle which belongs to the same share-group as created one.

You probably haven't used sharing recently (several passed years). The whole OpenGL spec is huge. If there is something you don't need you'll probably never notice that even exists. That's why I'm sniffing through the forums, hoping that I'll find something I'm mot aware of but can be useful ... :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!