texture-rectangle

This commit is contained in:
David Rose 2009-03-10 21:50:38 +00:00
parent ba30db6953
commit 89be2177c7

View File

@ -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;