public void Create(int width, int height)
        {
            if (glGenFramebuffersEXT == null)
            {
                glGenFramebuffersEXT         = OpenGL.GetDelegateFor <OpenGL.glGenFramebuffersEXT>();
                glBindFramebufferEXT         = OpenGL.GetDelegateFor <OpenGL.glBindFramebufferEXT>();
                glGenRenderbuffersEXT        = OpenGL.GetDelegateFor <OpenGL.glGenRenderbuffersEXT>();
                glBindRenderbufferEXT        = OpenGL.GetDelegateFor <OpenGL.glBindRenderbufferEXT>();
                glRenderbufferStorageEXT     = OpenGL.GetDelegateFor <OpenGL.glRenderbufferStorageEXT>();
                glFramebufferRenderbufferEXT = OpenGL.GetDelegateFor <OpenGL.glFramebufferRenderbufferEXT>();
                glDeleteRenderbuffersEXT     = OpenGL.GetDelegateFor <OpenGL.glDeleteRenderbuffersEXT>();
                glDeleteFramebuffersEXT      = OpenGL.GetDelegateFor <OpenGL.glDeleteFramebuffersEXT>();
            }
            //  First, create the frame buffer and bind it.
            glGenFramebuffersEXT(1, this.framebufferId);
            glBindFramebufferEXT(OpenGL.GL_FRAMEBUFFER, this.framebufferId[0]);

            //	Create the color render buffer and bind it, then allocate storage for it.
            glGenRenderbuffersEXT(1, this.colorRenderBufferId);
            glBindRenderbufferEXT(OpenGL.GL_RENDERBUFFER, this.colorRenderBufferId[0]);
            glRenderbufferStorageEXT(OpenGL.GL_RENDERBUFFER, OpenGL.GL_RGBA, width, height);

            //	Create the depth render buffer and bind it, then allocate storage for it.
            glGenRenderbuffersEXT(1, this.depthRenderBufferId);
            glBindRenderbufferEXT(OpenGL.GL_RENDERBUFFER, this.depthRenderBufferId[0]);
            glRenderbufferStorageEXT(OpenGL.GL_RENDERBUFFER, OpenGL.GL_DEPTH_COMPONENT24, width, height);

            //  Set the render buffer for color and depth.
            glFramebufferRenderbufferEXT(OpenGL.GL_FRAMEBUFFER, OpenGL.GL_COLOR_ATTACHMENT0,
                                         OpenGL.GL_RENDERBUFFER, this.colorRenderBufferId[0]);
            glFramebufferRenderbufferEXT(OpenGL.GL_FRAMEBUFFER, OpenGL.GL_DEPTH_ATTACHMENT,
                                         OpenGL.GL_RENDERBUFFER, this.depthRenderBufferId[0]);
        }
Exemple #2
0
 static Framebuffer()
 {
     glGenFramebuffers        = OpenGL.GetDelegateFor <OpenGL.glGenFramebuffersEXT>();
     glBindFramebuffer        = OpenGL.GetDelegateFor <OpenGL.glBindFramebufferEXT>();
     glFramebufferTexture2D   = OpenGL.GetDelegateFor <OpenGL.glFramebufferTexture2DEXT>();
     glCheckFramebufferStatus = OpenGL.GetDelegateFor <OpenGL.glCheckFramebufferStatusEXT>();
     glDeleteFramebuffers     = OpenGL.GetDelegateFor <OpenGL.glDeleteFramebuffersEXT>();
 }
Exemple #3
0
 static Framebuffer()
 {
     glGenFramebuffers = OpenGL.GetDelegateFor<OpenGL.glGenFramebuffersEXT>();
     glBindFramebuffer = OpenGL.GetDelegateFor<OpenGL.glBindFramebufferEXT>();
     glFramebufferTexture2D = OpenGL.GetDelegateFor<OpenGL.glFramebufferTexture2DEXT>();
     glCheckFramebufferStatus = OpenGL.GetDelegateFor<OpenGL.glCheckFramebufferStatusEXT>();
     glDeleteFramebuffers = OpenGL.GetDelegateFor<OpenGL.glDeleteFramebuffersEXT>();
 }
Exemple #4
0
 private void InitFramebufferExtensions()
 {
     if (glGenFramebuffers == null)
     {
         glGenFramebuffers        = OpenGL.GetDelegateFor <OpenGL.glGenFramebuffersEXT>();
         glBindFramebuffer        = OpenGL.GetDelegateFor <OpenGL.glBindFramebufferEXT>();
         glFramebufferTexture2D   = OpenGL.GetDelegateFor <OpenGL.glFramebufferTexture2DEXT>();
         glCheckFramebufferStatus = OpenGL.GetDelegateFor <OpenGL.glCheckFramebufferStatusEXT>();
         glDeleteFramebuffers     = OpenGL.GetDelegateFor <OpenGL.glDeleteFramebuffersEXT>();
     }
 }