Example #1
0
        public void AttachColorTexture(int index, DeviceTexture2D texture)
        {
            Bind();
            Debug.Assert(texture is OpenGLESTexture2D);
            OpenGLESTexture2D glTex = (OpenGLESTexture2D)texture;

            _colorTextures[index] = glTex;
            GL.ActiveTexture(TextureUnit.Texture0);
            Utilities.CheckLastGLES3Error();
            glTex.Bind();
            GL.FramebufferTexture2D(
                FramebufferTarget.Framebuffer,
                FramebufferAttachment.ColorAttachment0,
                TextureTarget2d.Texture2D,
                glTex.ID,
                0);
            GL.BindTexture(TextureTarget.Texture2D, 0);
            Utilities.CheckLastGLES3Error();
            DrawBufferMode mode = DrawBufferMode.ColorAttachment0 + index;

            GL.DrawBuffers(1, ref mode);
            Utilities.CheckLastGLES3Error();

            Unbind();
        }
Example #2
0
        public OpenGLESFramebuffer(OpenGLESTexture2D colorTexture, OpenGLESTexture2D depthTexture)
            : this()
        {
            _depthTexture = depthTexture;

            Bind();
            AttachColorTexture(0, colorTexture);
            AttachDepthTexture();
            Unbind();
        }