Ejemplo n.º 1
0
        public void BlitTo(FboWrapper _fboWrapperBlit, int _attachment)
        {
            GL.BindFramebuffer(FramebufferTarget.DrawFramebuffer, _fboWrapperBlit.m_fboId);
            GL.BindFramebuffer(FramebufferTarget.ReadFramebuffer, m_fboId);

            GL.DrawBuffer((DrawBufferMode)FramebufferAttachment.ColorAttachment0Ext + _attachment);
            GL.BindTexture(TextureTarget.Texture2D, _fboWrapperBlit.m_buffers[_attachment].TextureId);

            GL.BlitFramebuffer(0, 0, SIZE, SIZE, 0, 0, SIZE, SIZE, ClearBufferMask.ColorBufferBit,
                               BlitFramebufferFilter.Linear);

            GL.BindFramebuffer(FramebufferTarget.DrawFramebuffer, 0);
            GL.BindFramebuffer(FramebufferTarget.ReadFramebuffer, 0);
        }
Ejemplo n.º 2
0
        public ShadowMap()
            : base(Map.SIZE * VSZ, Map.SIZE * VSZ)
        {
            if (SZ*Map.SIZE > FboWrapper.SIZE)
            {
                throw new ApplicationException();
            }

            CreateShaders();

            m_fboWrapperBlit = new FboWrapper(false);
			m_t1 = m_fboWrapperBlit.AddTextureBuffer();
            m_t2 = m_fboWrapperBlit.AddTextureBuffer();
            m_fboWrapperBlit.Check();

            m_fboWrapper = new FboWrapper(true);
			//m_fboWrapper.AddTextureBuffer();

			VSync=VSyncMode.Off;
        }
Ejemplo n.º 3
0
        public ShadowMap()
            : base(Map.SIZE * VSZ, Map.SIZE * VSZ)
        {
            if (SZ * Map.SIZE > FboWrapper.SIZE)
            {
                throw new ApplicationException();
            }

            CreateShaders();

            m_fboWrapperBlit = new FboWrapper(false);
            m_t1             = m_fboWrapperBlit.AddTextureBuffer();
            m_t2             = m_fboWrapperBlit.AddTextureBuffer();
            m_fboWrapperBlit.Check();

            m_fboWrapper = new FboWrapper(true);
            //m_fboWrapper.AddTextureBuffer();

            VSync = VSyncMode.Off;
        }
Ejemplo n.º 4
0
            public DrawHelper(FboWrapper _fboWrapper)
            {
                var fboWrapper = _fboWrapper;

                GL.Flush();
                GL.GetInteger(GetPName.Viewport, m_savedViewport);
                GL.Ext.BindFramebuffer(FramebufferTarget.FramebufferExt, fboWrapper.m_fboId);

                GL.PushAttrib(AttribMask.ViewportBit);
                GL.Viewport(0, 0, SIZE, SIZE);

                GL.MatrixMode(MatrixMode.Projection);
                GL.PushMatrix();
                GL.LoadIdentity();
                GL.Ortho(0, SIZE, SIZE, 0, -1, 1);
                GL.Scale(1f, -1f, 1f);
                GL.Translate(0f, -SIZE, 0f);

                GL.Ext.BindRenderbuffer(RenderbufferTarget.RenderbufferExt, fboWrapper.m_renderBuffer);
                GL.BindTexture(TextureTarget.Texture2D, 0);

                //GL.Enable(EnableCap.Blend);
                //GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
            }
Ejemplo n.º 5
0
 public LosManagerEx()
 {
     m_fbo     = new FboWrapper(true);
     m_fboBlit = new FboWrapper(false);
 }
Ejemplo n.º 6
0
        public void BlitTo(FboWrapper _fboWrapperBlit, int _attachment)
        {
            GL.BindFramebuffer(FramebufferTarget.DrawFramebuffer, _fboWrapperBlit.m_fboId);
            GL.BindFramebuffer(FramebufferTarget.ReadFramebuffer, m_fboId);

            GL.DrawBuffer((DrawBufferMode) FramebufferAttachment.ColorAttachment0Ext + _attachment);
            GL.BindTexture(TextureTarget.Texture2D, _fboWrapperBlit.m_buffers[_attachment].TextureId);

            GL.BlitFramebuffer(0, 0, SIZE, SIZE, 0, 0, SIZE, SIZE, ClearBufferMask.ColorBufferBit,
                BlitFramebufferFilter.Linear);

            GL.BindFramebuffer(FramebufferTarget.DrawFramebuffer, 0);
            GL.BindFramebuffer(FramebufferTarget.ReadFramebuffer, 0);
        }
Ejemplo n.º 7
0
            public DrawHelper(FboWrapper _fboWrapper)
            {
                var fboWrapper = _fboWrapper;

                GL.Flush();
                GL.GetInteger(GetPName.Viewport, m_savedViewport);
                GL.Ext.BindFramebuffer(FramebufferTarget.FramebufferExt, fboWrapper.m_fboId);

                GL.PushAttrib(AttribMask.ViewportBit);
                GL.Viewport(0, 0, SIZE, SIZE);

                GL.MatrixMode(MatrixMode.Projection);
                GL.PushMatrix();
                GL.LoadIdentity();
                GL.Ortho(0, SIZE, SIZE, 0, -1, 1);
                GL.Scale(1f, -1f, 1f);
                GL.Translate(0f, -SIZE, 0f);

                GL.Ext.BindRenderbuffer(RenderbufferTarget.RenderbufferExt, fboWrapper.m_renderBuffer);
                GL.BindTexture(TextureTarget.Texture2D, 0);

                //GL.Enable(EnableCap.Blend);
                //GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);

            }