AdrianPi's picture

FrameBufferUnsupported error

Project:The Open Toolkit library
Version:0.9.9-3
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed
Description

Hi. I 'm getting FrameBufferUnsupported error when trying to do the following. What I'm doing wrong?

                // Create color texture
                reflectionTexture = GL.GenTexture();
                GL.BindTexture(TextureTarget.Texture2D, reflectionTexture);
                GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgb8, 
                    256, 256, 0, PixelFormat.Rgb, PixelType.UnsignedByte, IntPtr.Zero);                               
                GL.BindTexture(TextureTarget.Texture2D, 0);
 
                // Create depth buffer
                GL.GenRenderbuffers(1, out depthBuffer);
                GL.BindRenderbuffer(RenderbufferTarget.Renderbuffer, depthBuffer);
                GL.RenderbufferStorage(RenderbufferTarget.Renderbuffer, 
                    RenderbufferStorage.DepthComponent32, 256, 256);
 
                // Create framebuffer
                GL.GenFramebuffers(1, out frameBuffer);
                GL.BindFramebuffer(FramebufferTarget.Framebuffer, frameBuffer);
                // Attach color texture
                GL.FramebufferTexture2D(FramebufferTarget.Framebuffer, FramebufferAttachment.ColorAttachment0, 
                    TextureTarget.Texture2D, reflectionTexture, 0);
                // Attach depth buffer
                GL.FramebufferRenderbuffer(FramebufferTarget.Framebuffer, FramebufferAttachment.DepthAttachment,
                    RenderbufferTarget.Renderbuffer, depthBuffer);                
                GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0);
 
                GL.BindFramebuffer(FramebufferTarget.Framebuffer, frameBuffer);
                FramebufferErrorCode err = GL.CheckFramebufferStatus(FramebufferTarget.Framebuffer);
                GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0);

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
iliak's picture

#1

Have a look at my FrameBuffer code.

AdrianPi's picture

#2

Disregard, I make it work. I added GenerateMipMaps below TexImage2D. Don't know why is needed dough...

AdrianPi's picture

#4

Status:open» closed