FBO call surrogate

are you sure that value isn’t the trace substituting the value in for him?

Here is the real source code, please tell me what you think.

uint fb = 0;

fb = glGenFramebuffersEXT();

glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);

glBindTexture(gl.TEXTURE_2D, sharpTextureName);

glTexImage2D(gl.TEXTURE_2D, 0, GL_RGBA, textureSize, textureSize, 0, GL_BGRA, GL_UNSIGNED_BYTE, null);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, sharpTextureName, 0);

glBindTexture(GL_TEXTURE_2D, 0);

// draws on the texture here

glActiveTexture(GL_TEXTURE0);

glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, blurredTextureName, 0);

glBindTexture(GL_TEXTURE_2D, sharpTextureName);

glUseProgram(ShaderProgram);

// executes shader here
DrawQuadOnTexture();

glUseProgram(0);

Thanks,

Alberto

looks ok to me. I don’t use glIntercept myself - can you break on gl errors? If not try bugle or glsldevil, or add some calls to glGetError, you may want to add some code to check for fbo completeness too: (not my code btw)

bool checkFramebufferStatus() {
    GLenum status;
    status=(GLenum)glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
    switch(status) {
        case GL_FRAMEBUFFER_COMPLETE_EXT:
            return true;
        case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT:
            printf("Framebuffer incomplete,incomplete attachment
");
            return false;
        case GL_FRAMEBUFFER_UNSUPPORTED_EXT:
            printf("Unsupported framebuffer format
");
            return false;
        case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT:
            printf("Framebuffer incomplete,missing attachment (don't panic!)
");
            return false;
        case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT:
            printf("Framebuffer incomplete,attached images must have same dimensions
");
            return false;
        case GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT:
             printf("Framebuffer incomplete,attached images  must have same format
");
            return false;
        case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT:
            printf("Framebuffer incomplete,missing draw buffer
");
            return false;
        case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT:
            printf("Framebuffer incomplete,missing read buffer
");
            return false;
    }
  return false;
}

I’ll give a try to glsldevil FBO status always return OK.

Thanks,

Alberto

Unfortunately glslDevil doesn’t allow me to debug shaders…

In the meantime I discovered another strange thing. If I remove the marked line the render to texture stops working, while if I put it back it starts working again…

WHY?!?!

Thanks,

Alberto

fbo = gl.GenFramebuffersEXT();

glBindFramebufferEXT(gl.FRAMEBUFFER_EXT, fbo);

sharpTextureName = Viewport.GetNextTextureName();
glBindTexture(gl.TEXTURE_2D, sharpTextureName);

/* the line below */
gl.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
/* the line above */

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, textureSize, textureSize, 0, GL_RGBA, GL_UNSIGNED_BYTE, null);
                    
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, sharpTextureName, 0);

// Checks FBO status
int status = gl.CheckFramebufferStatusEXT(gl.FRAMEBUFFER_EXT);

// Draws on texture
DrawShadow();

You forgot to generate mipmaps.

Thanks ZbuffeR,

You are completely RIGHT! I don’t need mipmaps, so I will add that line.

Thanks so much again,

Alberto