From ba30db69538513cbc1e903e7cb8f77ef0f1b9db0 Mon Sep 17 00:00:00 2001 From: David Rose Date: Tue, 10 Mar 2009 20:43:33 +0000 Subject: [PATCH] support window-type offscreen better --- .../glstuff/glGraphicsStateGuardian_src.cxx | 2 +- panda/src/wgldisplay/wglGraphicsBuffer.cxx | 2 ++ panda/src/wgldisplay/wglGraphicsPipe.cxx | 20 ++++++++++++++----- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index cdb33ea864..e5b75484ef 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -4926,7 +4926,7 @@ set_read_buffer(int rbtype) { break; default: - GLP(ReadBuffer)(GL_FRONT_AND_BACK); + break; } } diff --git a/panda/src/wgldisplay/wglGraphicsBuffer.cxx b/panda/src/wgldisplay/wglGraphicsBuffer.cxx index 9a28f57386..ddbf1bb484 100644 --- a/panda/src/wgldisplay/wglGraphicsBuffer.cxx +++ b/panda/src/wgldisplay/wglGraphicsBuffer.cxx @@ -282,6 +282,8 @@ open_buffer() { // So always use a single-buffered gsg. _fb_properties.set_back_buffers(0); + _draw_buffer_type = RenderBuffer::T_front; + _screenshot_buffer_type = RenderBuffer::T_front; // GSG creation/initialization. diff --git a/panda/src/wgldisplay/wglGraphicsPipe.cxx b/panda/src/wgldisplay/wglGraphicsPipe.cxx index 5235e55238..aaf3c58455 100644 --- a/panda/src/wgldisplay/wglGraphicsPipe.cxx +++ b/panda/src/wgldisplay/wglGraphicsPipe.cxx @@ -189,19 +189,27 @@ make_output(const string &name, // Third thing to try: a wglGraphicsBuffer if (retry == 2) { - if ((!support_rtt)|| - ((flags&BF_require_parasite)!=0)|| - ((flags&BF_require_window)!=0)|| - ((flags&BF_rtt_cumulative)!=0)|| - ((flags&BF_can_bind_every)!=0)) { + if (((flags&BF_require_parasite)!=0)|| + ((flags&BF_require_window)!=0)) { return NULL; } + + if (!support_rtt) { + if (((flags&BF_rtt_cumulative)!=0)|| + ((flags&BF_can_bind_every)!=0)) { + // If we require Render-to-Texture, but can't be sure we + // support it, bail. + return NULL; + } + } + // Early failure - if we are sure that this buffer WONT // meet specs, we can bail out early. if ((flags & BF_fb_props_optional) == 0) { if ((fb_prop.get_aux_rgba() > 0)|| (fb_prop.get_aux_rgba() > 0)|| (fb_prop.get_aux_float() > 0)) { + cerr << "b\n"; return NULL; } } @@ -213,8 +221,10 @@ make_output(const string &name, (wglgsg->pfnum_supports_pbuffer()) && (wglgsg->get_fb_properties().subsumes(fb_prop))&& (wglgsg->get_fb_properties().is_single_buffered())) { + cerr << "c\n"; precertify = true; } + cerr << "d\n"; return new wglGraphicsBuffer(engine, this, name, fb_prop, win_prop, flags, gsg, host); }