From 89be2177c7ab008cf47018dd4f5984114279945d Mon Sep 17 00:00:00 2001 From: David Rose Date: Tue, 10 Mar 2009 21:50:38 +0000 Subject: [PATCH] texture-rectangle --- panda/src/osxdisplay/osxGraphicsBuffer.cxx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/panda/src/osxdisplay/osxGraphicsBuffer.cxx b/panda/src/osxdisplay/osxGraphicsBuffer.cxx index 80f719ece0..12832d5032 100644 --- a/panda/src/osxdisplay/osxGraphicsBuffer.cxx +++ b/panda/src/osxdisplay/osxGraphicsBuffer.cxx @@ -161,7 +161,15 @@ open_buffer() { } if (_pbuffer == NULL) { - if (!aglCreatePBuffer(_x_size, _y_size, GL_TEXTURE_2D, GL_RGBA, 0, &_pbuffer)) { + GLenum target = GL_TEXTURE_RECTANGLE_ARB; + if (_x_size == Texture::up_to_power_2(_x_size) && + _y_size == Texture::up_to_power_2(_x_size)) { + // It's a power-of-two size, so we can use GL_TEXTURE_2D as the + // target. Dunno, but maybe this will be more likely to work on + // some hardware. + target = GL_TEXTURE_2D; + } + if (!aglCreatePBuffer(_x_size, _y_size, target, GL_RGBA, 0, &_pbuffer)) { aglReportError("aglCreatePBuffer"); close_buffer(); return false;