MCPcopy Create free account
hub / github.com/NVIDIA/cuda-samples / CFrameBufferObject

Class CFrameBufferObject

Common/rendercheck_gles.h:727–1045  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

725};
726
727class CFrameBufferObject {
728 public:
729 CFrameBufferObject(unsigned int width, unsigned int height, unsigned int Bpp,
730 bool bUseFloat, GLenum eTarget)
731 : m_Width(width),
732 m_Height(height),
733 m_bUseFloat(bUseFloat),
734 m_eGLTarget(eTarget) {
735 glGenFramebuffers(1, &m_fboData.fb);
736
737 m_fboData.colorTex =
738 createTexture(m_eGLTarget, width, height, GL_RGBA, GL_RGBA);
739 m_fboData.depthTex = createTexture(
740 m_eGLTarget, width, height, GL_DEPTH_COMPONENT24, GL_DEPTH_COMPONENT);
741
742 attachTexture(m_eGLTarget, m_fboData.depthTex, GL_DEPTH_ATTACHMENT);
743 attachTexture(m_eGLTarget, m_fboData.colorTex, GL_COLOR_ATTACHMENT0);
744
745 bool ret = checkStatus(__FILE__, __LINE__, false);
746 }
747
748 void check_gl_error(const char *file, int line) {
749 GLenum err(glGetError());
750
751 while (err != GL_NO_ERROR) {
752 char error[64];
753
754 switch (err) {
755 case GL_INVALID_OPERATION:
756 strcpy(error, "INVALID_OPERATION");
757 break;
758 case GL_INVALID_ENUM:
759 strcpy(error, "INVALID_ENUM");
760 break;
761 case GL_INVALID_VALUE:
762 strcpy(error, "INVALID_VALUE");
763 break;
764 case GL_OUT_OF_MEMORY:
765 strcpy(error, "OUT_OF_MEMORY");
766 break;
767 case GL_INVALID_FRAMEBUFFER_OPERATION:
768 strcpy(error, "INVALID_FRAMEBUFFER_OPERATION");
769 break;
770 }
771
772 printf("GL_%s - %s : %d\n", error, file, line);
773 err = glGetError();
774 }
775 }
776
777 virtual ~CFrameBufferObject() { freeResources(); }
778
779 GLuint createTexture(GLenum target, int w, int h, GLint internalformat,
780 GLenum format) {
781 GLuint texid;
782 glGenTextures(1, &texid);
783
784 glBindTexture(target, texid);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected