Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Don't forget to read Tuesday's email newsletter for your chance to win a free copy of Construct 2!


multiple windows/instances and gl::GL_MAX_DRAW_BUFFERS


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 miggs   Members   -  Reputation: 260

Like
0Likes
Like

Posted 05 February 2013 - 08:14 PM

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, 05 February 2013 - 11:11 PM.


Sponsor:

#2 Arkhyl   Members   -  Reputation: 571

Like
1Likes
Like

Posted 06 February 2013 - 01:59 AM

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?



#3 miggs   Members   -  Reputation: 260

Like
0Likes
Like

Posted 06 February 2013 - 11:18 AM

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, 07 February 2013 - 10:34 AM.





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