Jump to content
  • Advertisement
Sign in to follow this  
fazekaim

fbo problem with ATI (solved)

This topic is 4817 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, i'm using fbo in my program, and my fbo creation isn' work at all on ATI. But on NVidia, it works well. How can i fix this problem? my fbo creation:
public static String checkFrameBufferStatus( ) {
        int status = gl.glCheckFramebufferStatusEXT( GL.GL_FRAMEBUFFER_EXT );
        switch(status) {
            case GL.GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENTS_EXT:
                return "FrameBuffer incoplete attachments";
            case GL.GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT:
                return "FrameBuffer incoplete missing attachment";
            case GL.GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT:
                return "FrameBuffer incoplete duplicate";
            case GL.GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT:
                return "FrameBuffer incoplete dimensions";
            case GL.GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT:
                return "FrameBuffer incoplete formats";
            case GL.GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT:
                return "FrameBuffer incoplete draw buffer";
            case GL.GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT:
                return "FrameBuffer incoplete read buffer";
            case GL.GL_FRAMEBUFFER_COMPLETE_EXT:
                return "OK";
            case GL.GL_FRAMEBUFFER_UNSUPPORTED_EXT:
                return "FrameBuffer unsupported";
            default:
                return "FrameBuffer unreckognized error";
        }
    }


    public static void createNewShadowFrameBuffer(int width, int height, int[] FBO, int[] FBORenderBuffer, int[] FBOTexture ){
        if( FBORenderBuffer[0] > 0 )    gl.glDeleteRenderbuffersEXT( 1, FBOTexture );
        if( FBOTexture[0] > 0 )         gl.glDeleteTextures( 1, FBOTexture );
        if( FBO[0] > 0 )                gl.glDeleteFramebuffersEXT( 1, FBOTexture );

        gl.glGenFramebuffersEXT(1, FBO);
        gl.glBindFramebufferEXT( GL.GL_FRAMEBUFFER_EXT, FBO[0] );
        // depth buffer rendered to texture
        gl.glGenTextures(1, FBORenderBuffer);
        gl.glBindTexture( GL.GL_TEXTURE_2D, FBORenderBuffer[0] );
        gl.glTexImage2D( GL.GL_TEXTURE_2D, 0, GL.GL_DEPTH_COMPONENT24, width, height, 0,  GL.GL_DEPTH_COMPONENT,  GL.GL_FLOAT, BufferUtils.bufferOffset(0) ); // not unsigned byte but float

        gl.glTexParameteri( GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, GL.GL_CLAMP );
        gl.glTexParameteri( GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, GL.GL_CLAMP );

        gl.glTexParameteri( GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST );
        gl.glTexParameteri( GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST );

        gl.glFramebufferTexture2DEXT( GL.GL_FRAMEBUFFER_EXT,  GL.GL_DEPTH_ATTACHMENT_EXT,  GL.GL_TEXTURE_2D, FBORenderBuffer[0], 0 );

        gl.glDrawBuffer( GL.GL_NONE );
        gl.glReadBuffer( GL.GL_NONE );

        String message = "";
        if( !( (message = EngineReckonings.checkFrameBufferStatus( )).equals("OK")) ){
            JOptionPane.showMessageDialog(null,  message, "FBO jajjajj", JOptionPane.ERROR_MESSAGE);
            System.exit( -1 );
        }

        gl.glBindFramebufferEXT(GL.GL_FRAMEBUFFER_EXT, 0);
    }



The error message: FrameBuffer incoplete attachments Thanks... [Edited by - fazekaim on October 11, 2005 7:32:32 AM]

Share this post


Link to post
Share on other sites
Advertisement
I think the GL.GL_DEPTH_COMPONENT24 and GL.GL_FLOAT are going to be the root of your problem as the example code from the FBO PDF in ATI's new SDK has that as GL_DEPTH_COMPONENT16 and an unsigned byte as format.

maybe swapping GL.GL_FLOAT for an unsigned int type might work...

Share this post


Link to post
Share on other sites
afaik they do.. however as to if they support it as a render target for FBO is another matter (its probably an alignment thing, 24bit data doesnt align well, however the new depthstencil extension should/might fix this problem, so once that appears in the driver you might want to revisit this code [smile])

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!