コード例 #1
0
ファイル: FboWrapper.cs プロジェクト: Foxbow74/my-busycator
        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);
        }
コード例 #2
0
ファイル: ShadowMap.cs プロジェクト: Foxbow74/my-busycator
        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;
        }
コード例 #3
0
ファイル: ShadowMap.cs プロジェクト: Foxbow74/my-busycator
        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;
        }
コード例 #4
0
ファイル: FboWrapper.cs プロジェクト: Foxbow74/my-busycator
            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);
            }
コード例 #5
0
ファイル: LosManagerEx.cs プロジェクト: Foxbow74/my-busycator
 public LosManagerEx()
 {
     m_fbo     = new FboWrapper(true);
     m_fboBlit = new FboWrapper(false);
 }
コード例 #6
0
ファイル: FboWrapper.cs プロジェクト: Foxbow74/my-busycator
        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);
        }
コード例 #7
0
ファイル: FboWrapper.cs プロジェクト: Foxbow74/my-busycator
            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);

            }