What is wrong with my code?

I finally got it not to return 1280 or 1282, but it still crashes at the glBlitFramebufferEXT. Can you help, I removed all the error checking code from the code below to make the code more readable:


	Engine::glGenFramebuffersEXT(1, &sourceImg.rFBO);
        Engine::glBindFramebufferEXT( GL_READ_FRAMEBUFFER_EXT, sourceImg.rFBO );
        Engine::glFramebufferTexture2DEXT( GL_READ_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, sourceImg.rTexID, 0 );
        glReadBuffer( GL_COLOR_ATTACHMENT0_EXT );

        Engine::glGenFramebuffersEXT(1, &this->rFBO);
        Engine::glBindFramebufferEXT( GL_DRAW_FRAMEBUFFER_EXT, this->rFBO );
        Engine::glFramebufferTexture2DEXT( GL_DRAW_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT + this->colorattachment_ord, GL_TEXTURE_2D, this->rTexID, 0 );
        glDrawBuffer( GL_COLOR_ATTACHMENT1_EXT );
        
        Engine::glBlitFramebufferEXT(
                       0, 0, sourceImg.rWidth, sourceImg.rHeight,
                       x, y, x + sourceImg.rWidth, y + sourceImg.rHeight,
                       GL_COLOR_BUFFER_BIT,
                       GL_LINEAR);

I’m trying to draw from sourceImg OpenGL 2D texture to destination OpenGL 2D texture.

Try something like

glBindFramebuffer(GL_READ_FRAMEBUFFER, fbSrc);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbDst);
glBlitFramebuffer(…);

Your source and destination formats must be compatible or GL will complain bitterly with an INVALID_OPERATION error (be sure to check glGetError and glCheckFramebufferStatus here and there).

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.