Jump to content
  • Advertisement
Sign in to follow this  
browny

OpenGL context switch in OpenGL

This topic is 4640 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

suppose my current context is set to X and then i did glBegin(...) but before doing the glEnd(), if i change the context and then after a while come back to the old context (X) and add few more glVertex.. and then glEnd().. will that work,, i mean... will OpenGL retain the old states in X context ? Another Question: When doing glDrawPixels, is there any way to use PixelShader ?

Share this post


Link to post
Share on other sites
Advertisement
I don't think the spec is clear on this but I can virtually assure you, you will not get a good result from doing this, and whatever happens may be implementation-specific. Why would you want to?

DrawPixels with a pixel shader... as far as I know, it should work, with the caveat that you have no interpolants, all per-vertex state is part of the raster position. if you want to do something useful along these lines, you are probably better off creating a texture with the image and rendering a screen aligned quad.

Share this post


Link to post
Share on other sites
one more question!

suppose i have two threads, A and B. Each thread has its own display with a seperate OpenGL context. Now, in the middle of issuing gl commands, there might be context switch between the threads in the CPU. Will that create problems ? and if it does, what is the solution ?

Share this post


Link to post
Share on other sites
Should not be a problem, assuming the implementation is thread-safe. All NVIDIA drivers are thread-safe, I don't know about the others.

Share this post


Link to post
Share on other sites
Switching context between a begin/end sounds like something that would not work.

The man page for glXMakeCurrent says:

Quote:

ERRORS
GLXBadContextState is generated if glXMakeCurrent is executed between
the execution of glBegin and the corresponding execution of glEnd.


Of course that doesn't mean that the respective wgl function won't work on Windows, but it's a suggestion that it's generally a bad idea.

On the other hand, having multiple contexts in multiple threads should be fine. That's supposed to work.

Mark

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!