我有一个 IOSurface 支持的纹理,它仅限于 GL_TEXTURE_RECTANGLE_ARB 并且不支持 mipmapping。我正在尝试将此纹理复制到绑定到 GL_TEXTURE_2D 的另一个纹理,然后在该纹理上执行 mipmapping。但是我在复制我的纹理时遇到了问题。我什至无法通过将其复制到另一个 GL_TEXTURE_RECTANGLE_ARB 来使其工作。这是我的代码:
var arbTexture = GLuint()
glGenTextures(1, &arbTexture)
/* Do some stuff to fill arbTexture with image data */
glEnable(GLenum(GL_TEXTURE_RECTANGLE_ARB))
glBindTexture(GLenum(GL_TEXTURE_RECTANGLE_ARB), arbTexture)
// At this point, if I return here, my arbTexture draws just fine
// Trying to copy to another texture (fbo and texture generated previously):
glBindFramebuffer(GLenum(GL_FRAMEBUFFER), fbo);
glFramebufferTexture2D(GLenum(GL_READ_FRAMEBUFFER), GLenum(GL_COLOR_ATTACHMENT0), GLenum(GL_TEXTURE_RECTANGLE_ARB), arbTexture, 0)
glFramebufferTexture2D(GLenum(GL_DRAW_FRAMEBUFFER), GLenum(GL_COLOR_ATTACHMENT1), GLenum(GL_TEXTURE_RECTANGLE_ARB), texture, 0)
glDrawBuffer(GLenum(GL_COLOR_ATTACHMENT1))
glBlitFramebuffer(0, 0, GLsizei(width), GLsizei(height), 0, 0, GLsizei(width), GLsizei(height), GLbitfield(GL_COLOR_BUFFER_BIT)
, GLenum(GL_NEAREST))
glBindTexture(GLenum(GL_TEXTURE_RECTANGLE_ARB), texture)
// At this point, the texture is all black