Jump to content
  • Advertisement
Sign in to follow this  
miggs

OpenGL multiple windows/instances and gl::GL_MAX_DRAW_BUFFERS

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

hi,

 

my current renderer uses a number of frame+renderbuffers and rendertextures at the moment. I wanted to implenent the possibility to render to multiple independent windows and got multiple OpenGL 3.0 contexts running and at first it worked, without render buffers on the other windows.

 

But when the second windows' scene got more complex and I added renderbuffers and framebuffers the problems began.

 

 

GLint maxBuffers;
gl::GetIntegerv(gl::GL_MAX_DRAW_BUFFERS, &maxBuffers);

returns 8, and the first window consumes 5-6. I tried starting my app.exe twice with only 1 window and both ran without any trouble (2 app.exe each 1 window), but when starting only 1 app.exe and having it spawn 2 windows with each a context, i get GL_INVALID_VALUE on gl::GenFramebuffers, which indicates to me that both contexts' buffer count add up.

 

 

How can i have my HGLRC's work indepentent like 2 separate apps, within one?

Thanks in advance

Edited by miggs

Share this post


Link to post
Share on other sites
Advertisement

GL_MAX_DRAW_BUFFERS indicate the maximum number of buffers in which you can simultaneously draw, not the number you can create. So your problem is not here.

 

Do you call wglMakeCurrent in each thread in order to use the correct context?

Share this post


Link to post
Share on other sites

i do call wglMakeCurrent, but the thing is: i don't call it in each thread, since i only run 1 thread. I do run both window computations and draw methods one after the other. (both windows don't need a lot of computations so this works for me i'd like to keep it simple)

 

imagine my loop is like:

instance1 = new inst... // an instance containing it's scene logic, window, and opengl context
instance2 = new inst...

while(myloopShouldBeRunning)
{
    instance1->update()->draw(); // calls makecurrent does it's stuff and renders
    instance2->update()->draw(); 
}

 

could the problem be that i run multiple contexts on the same thread?

 

 

EDIT:

problem solved

 

a background worker thread had some old not cleaned up messy code that switched the context in some cases at uncontrolled times...

Edited by miggs

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!