bool begin() { bool Validated = glf::checkGLVersion(SAMPLE_MAJOR_VERSION, SAMPLE_MINOR_VERSION); if(Validated) Validated = initTest(); if(Validated) Validated = initProgram(); if(Validated) Validated = initTextureBuffer(); if(Validated) Validated = initArrayBuffer(); if(Validated) Validated = initVertexArray(); return Validated && glf::checkError("begin"); }
void fbo::initFrameBuffer(void){ initDepthBuffer(); // Initialize our frame buffer depth buffer initTextureBuffer(); // Initialize our frame buffer texture glGenFramebuffersEXT(1, &id); // Generate one frame buffer and store the ID in fbo glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, id); // Bind our frame buffer glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, texture_id, 0); // Attach the texture fbo_texture to the color buffer in our frame buffer glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, depth_id); // Attach the depth buffer fbo_depth to our frame buffer GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); // Check that status of our generated frame buffer if (status != GL_FRAMEBUFFER_COMPLETE_EXT) // If the frame buffer does not report back as complete { std::cout << "Couldn't create frame buffer" << std::endl; // Output an error to the console } glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); // Unbind our frame buffer }
bool begin() { GLint MajorVersion = 0; GLint MinorVersion = 0; glGetIntegerv(GL_MAJOR_VERSION, &MajorVersion); glGetIntegerv(GL_MINOR_VERSION, &MinorVersion); bool Validated = (MajorVersion * 10 + MinorVersion) >= (SAMPLE_MAJOR_VERSION * 10 + SAMPLE_MINOR_VERSION); if(Validated) Validated = initTest(); if(Validated) Validated = initProgram(); if(Validated) Validated = initTextureBuffer(); if(Validated) Validated = initArrayBuffer(); if(Validated) Validated = initVertexArray(); return Validated && glf::checkError("begin"); }