void testApp::printFramebufferInfo() { cout << "\n***** FBO STATUS *****\n"; // print max # of colorbuffers supported by FBO int colorBufferCount = 0; glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &colorBufferCount); cout << "Max Number of Color Buffer Attachment Points: " << colorBufferCount << endl; int objectType; int objectId; // print info of the colorbuffer attachable image for(int i = 0; i < colorBufferCount; ++i) { glGetFramebufferAttachmentParameterivEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT+i, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT, &objectType); if(objectType != GL_NONE) { glGetFramebufferAttachmentParameterivEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT+i, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT, &objectId); std::string formatName; cout << "Color Attachment " << i << ": "; if(objectType == GL_TEXTURE) cout << "GL_TEXTURE, " << getTextureParameters(objectId) << endl; else if(objectType == GL_RENDERBUFFER_EXT) cout << "GL_RENDERBUFFER_EXT, " << getRenderbufferParameters(objectId) << endl; } } // print info of the depthbuffer attachable image glGetFramebufferAttachmentParameterivEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT, &objectType); if(objectType != GL_NONE) { glGetFramebufferAttachmentParameterivEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT, &objectId); cout << "Depth Attachment: "; switch(objectType) { case GL_TEXTURE: cout << "GL_TEXTURE, " << getTextureParameters(objectId) << endl; break; case GL_RENDERBUFFER_EXT: cout << "GL_RENDERBUFFER_EXT, " << getRenderbufferParameters(objectId) << endl; break; } } // print info of the stencilbuffer attachable image glGetFramebufferAttachmentParameterivEXT(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT, &objectType); if(objectType != GL_NONE) { glGetFramebufferAttachmentParameterivEXT(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT, &objectId); cout << "Stencil Attachment: "; switch(objectType) { case GL_TEXTURE: cout << "GL_TEXTURE, " << getTextureParameters(objectId) << endl; break; case GL_RENDERBUFFER_EXT: cout << "GL_RENDERBUFFER_EXT, " << getRenderbufferParameters(objectId) << endl; break; } } cout << endl; }
/////////////////////////////////////////////////////////////////////////////// // print out the FBO infos /////////////////////////////////////////////////////////////////////////////// void printFramebufferInfo(GLuint fbo) { // bind fbo glBindFramebuffer(GL_FRAMEBUFFER, fbo); std::cout << "\n===== FBO STATUS =====\n"; // print max # of colorbuffers supported by FBO int colorBufferCount = 0; glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS, &colorBufferCount); std::cout << "Max Number of Color Buffer Attachment Points: " << colorBufferCount << std::endl; // get max # of multi samples int multiSampleCount = 0; glGetIntegerv(GL_MAX_SAMPLES, &multiSampleCount); std::cout << "Max Number of Samples for MSAA: " << multiSampleCount << std::endl; int objectType; int objectId; // print info of the colorbuffer attachable image for(int i = 0; i < colorBufferCount; ++i) { glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0+i, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &objectType); if(objectType != GL_NONE) { glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0+i, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, &objectId); std::string formatName; std::cout << "Color Attachment " << i << ": "; if(objectType == GL_TEXTURE) { std::cout << "GL_TEXTURE, " << getTextureParameters(objectId) << std::endl; } else if(objectType == GL_RENDERBUFFER) { std::cout << "GL_RENDERBUFFER, " << getRenderbufferParameters(objectId) << std::endl; } } } // print info of the depthbuffer attachable image glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &objectType); if(objectType != GL_NONE) { glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, &objectId); std::cout << "Depth Attachment: "; switch(objectType) { case GL_TEXTURE: std::cout << "GL_TEXTURE, " << getTextureParameters(objectId) << std::endl; break; case GL_RENDERBUFFER: std::cout << "GL_RENDERBUFFER, " << getRenderbufferParameters(objectId) << std::endl; break; } } // print info of the stencilbuffer attachable image glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &objectType); if(objectType != GL_NONE) { glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, &objectId); std::cout << "Stencil Attachment: "; switch(objectType) { case GL_TEXTURE: std::cout << "GL_TEXTURE, " << getTextureParameters(objectId) << std::endl; break; case GL_RENDERBUFFER: std::cout << "GL_RENDERBUFFER, " << getRenderbufferParameters(objectId) << std::endl; break; } } std::cout << std::endl; glBindFramebuffer(GL_FRAMEBUFFER, 0); }