protected override void BindSurfaceImpl(int attachment, RenderTexture target)
        {
            //Check if the render target is in the rendertarget.FBO map
            GLES2FrameBufferObject fboojb = null;

            fboojb = (GLES2FrameBufferObject)target["FBO"];
            this.fbo.BindSurface(attachment, fboojb.GetSurface(0));

            width  = this.fbo.Width;
            height = this.fbo.Height;
        }
Example #2
0
        public override void Bind(Graphics.RenderTarget target)
        {
            //Check if the render target is in the rendertarget.FBO map
            GLES2FrameBufferObject fbo = null;

            fbo = (GLES2FrameBufferObject)target["FBO"];
            if (fbo != null)
            {
                fbo.Bind();
            }
            else
            {
                //Old style context (window/pbuffer) or copying render texture

                //Ogre says 1 is screenbuffer on iOS as opposed to 0 on Android
#if MONOTOUCH
                GL.BindFramebuffer(GLenum.Framebuffer, 1);
#else
                GL.BindFramebuffer(GLenum.Framebuffer, 0);
#endif
                GLES2Config.GlCheckError(this);
            }
        }
 public GLES2FBOMultiRenderTarget(GLES2FBOManager manager, string name)
     : base(name)
 {
     this.fbo = new GLES2FrameBufferObject(manager, 0);               //Ogre TODO: multisampling on MRTs?
 }
Example #4
0
        /// <summary>
        /// </summary>
        /// <param name="renderTarget"> </param>
        /// <returns> </returns>
        public override bool IsCompatible(RenderTarget renderTarget)
        {
            bool retVal = false;

            //Check standard stuff first.
            if (this._renderSystem.Capabilities.HasCapability(Capabilities.RTTDepthbufferResolutionLessEqual))
            {
                if (base.IsCompatible(renderTarget))
                {
                    return(false);
                }
            }
            else
            {
                if (Width != renderTarget.Width || Height != renderTarget.Height || Fsaa != renderTarget.FSAA)
                {
                    return(false);
                }
            }
            //Now check this is the appropriate format
            GLES2FrameBufferObject fbo = null;

            fbo = (GLES2FrameBufferObject)renderTarget["FBO"];

            if (fbo == null)
            {
                var windowContext = (GLES2Context)renderTarget["GLCONTEXT"];

                //Non-FBO and FBO depth surfaces don't play along, only dummmies which match the same
                //context
                if (this._depthBuffer == null && this._stencilBuffer == null && this._creatorContext == windowContext)
                {
                    retVal = true;
                }
            }
            else
            {
                //Check this isn't a dummy non-FBO depth buffer with an FBO target, don't mix them.
                //If you don't want depth buffer, use a Null Depth Buffer, not a dummy one.
                if (this._depthBuffer != null || this._stencilBuffer != null)
                {
                    var    internalFormat = fbo.Format;
                    GLenum depthFormat = GLenum.None, stencilFormat = GLenum.None;
                    this._renderSystem.GetDepthStencilFormatFor(internalFormat, ref depthFormat, ref stencilFormat);
                    bool bSameDepth = false;
                    if (this._depthBuffer != null)
                    {
                        bSameDepth |= this._depthBuffer.GLFormat == depthFormat;
                    }

                    bool bSameStencil = false;
                    if (this._stencilBuffer == null || this._stencilBuffer == this._depthBuffer)
                    {
                        bSameDepth = stencilFormat == GLenum.None;
                    }
                    else
                    {
                        if (this._stencilBuffer != null)
                        {
                            bSameStencil = stencilFormat == this._stencilBuffer.GLFormat;
                        }
                    }

                    retVal = bSameDepth && bSameStencil;
                }
            }

            return(retVal);
        }
		public GLES2FBOMultiRenderTarget( GLES2FBOManager manager, string name )
			: base( name )
		{
			this.fbo = new GLES2FrameBufferObject( manager, 0 ); //Ogre TODO: multisampling on MRTs?
		}