14#ifndef CSCI441_FRAMEBUFFER_UTILS_HPP
15#define CSCI441_FRAMEBUFFER_UTILS_HPP
18#include "LogUtils.hpp"
20#ifdef CSCI441_USE_GLEW
69 if(glIsFramebuffer(fbo)) {
70 glBindFramebuffer( target, fbo );
73 glGetIntegerv( GL_DRAW_BUFFER0 + i, &buffer );
74 if( buffer != GL_NONE ) {
75 CSCI441::LogUtils::log(
"[FBO]: Shader Output Location %d -> color attachment %d\n", i, buffer - GL_COLOR_ATTACHMENT0 );
76 glGetFramebufferAttachmentParameteriv( target, buffer, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &res );
77 CSCI441::LogUtils::log(
"[FBO]: \tAttachment Type: %s\n", res == GL_TEXTURE ?
"Texture" :
"Render Buffer" );
78 glGetFramebufferAttachmentParameteriv( target, buffer, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, &res );
82 }
while( buffer != GL_NONE );
90 if(glIsFramebuffer(fbo)) {
91 glBindFramebuffer( target, fbo );
99 GLenum status = glCheckFramebufferStatus( target );
100 if( status == GL_FRAMEBUFFER_COMPLETE )
106 case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
110 case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
111 CSCI441::LogUtils::logError(
"[FBO]: Attachments are missing! At least one image (texture) must be bound to the framebuffer object!\n");
114 case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT:
115 CSCI441::LogUtils::logError(
"[FBO]: The dimensions of the buffers attached to the currently used framebuffer object do not match!\n");
118 case GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT:
119 CSCI441::LogUtils::logError(
"[FBO]: The formats of the currently used framebuffer object are not supported or do not fit together!\n");
122 case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER:
123 CSCI441::LogUtils::logError(
"[FBO]: A Draw buffer is incomplete or undefined. All draw buffers must specify attachment points that have images attached.\n");
126 case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER:
127 CSCI441::LogUtils::logError(
"[FBO]: A Read buffer is incomplete or undefined. All read buffers must specify attachment points that have images attached.\n");
130 case GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:
134 case GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS :
135 CSCI441::LogUtils::logError(
"[FBO]: If a layered image is attached to one attachment, then all attachments must be layered attachments. The attached layers do not have to have the same number of layers, nor do the layers have to come from the same kind of texture.\n");
138 case GL_FRAMEBUFFER_UNSUPPORTED:
void printFramebufferInfo(GLenum target, GLuint fbo)
Prints the framebuffer information for the FBO attached to the corresponding target.
Definition: FramebufferUtils.hpp:65
void printFramebufferStatusMessage(GLenum target, GLuint fbo)
Prints the framebuffer status for the FBO attached to the corresponding target.
Definition: FramebufferUtils.hpp:89
void log(const char *MSG,...)
log a message to both the standard output stream and file
Definition: LogUtils.hpp:116
void logError(const char *MSG,...)
log a message to both the standard error stream and file
Definition: LogUtils.hpp:128
CSCI441 Helper Functions for OpenGL.
Definition: ArcballCam.hpp:17
OpenGL Framebuffer Utility functions.