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(); }
private void AttachDepthTexture() { Bind(); int depthTextureID; if (_depthTexture != null) { _depthTexture.Bind(); depthTextureID = _depthTexture.ID; } else { depthTextureID = 0; } GL.FramebufferTexture2D( FramebufferTarget.Framebuffer, FramebufferAttachment.DepthAttachment, TextureTarget2d.Texture2D, depthTextureID, 0); Unbind(); }