コード例 #1
0
        public override void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            base.GetObjectData(info, context);
            TextureParameters shadowmapTextureParameters = m_shadowMapTexture.GetTextureParameters();

            info.AddValue("shadowMapTextureParameters", shadowmapTextureParameters, typeof(TextureParameters));
        }
コード例 #2
0
        private void Render(ITexture renderTexture, Int32 index)
        {
            PostConstructor();

            var  texturePixelFormat = renderTexture.GetTextureParameters().TexPixelFormat;
            bool bDepthTexture      = (texturePixelFormat == PixelFormat.DepthComponent || texturePixelFormat == PixelFormat.DepthComponent);


            var screenSpaceMatrix = GetScreenSpaceMatrix(index);

            _shader.startProgram();
            renderTexture.BindTexture(TextureUnit.Texture0);
            _shader.SetIsDepthTexture(bDepthTexture);
            _shader.SetIsSeparatedScreen(false);
            _shader.SetUiTextureSampler(0);
            _shader.SetScreenSpaceMatrix(screenSpaceMatrix);
            _buffer.RenderVAO(PrimitiveType.Triangles);
            _shader.stopProgram();
        }
コード例 #3
0
        public static ITexture CopyTexture(ITexture src)
        {
            ITexture dst = PoolProxy.GetResource <ObtainRenderTargetPool, RenderTargetAllocationPolicy, TextureParameters, ITexture>(src.GetTextureParameters());

            var renderTarget = GL.GenFramebuffer();

            GL.BindFramebuffer(FramebufferTarget.Framebuffer, renderTarget);
            GL.FramebufferTexture2D(FramebufferTarget.Framebuffer, FramebufferAttachment.ColorAttachment0, src.GetTextureParameters().TexTarget, dst.GetTextureDescriptor(), 0);
            GL.DrawBuffer(DrawBufferMode.ColorAttachment0);

            //GL.Disable(EnableCap.DepthTest);
            GL.Viewport(0, 0, src.GetTextureRezolution().X, src.GetTextureRezolution().Y);
            // start copy texture to render target
            copyShader.startProgram();
            src.BindTexture(TextureUnit.Texture0);
            copyShader.SetUniformValues(0);
            var quadBuffer = ScreenQuad.GetScreenQuadBuffer();

            quadBuffer.RenderVAO(PrimitiveType.Triangles);
            copyShader.stopProgram();
            GL.Enable(EnableCap.DepthTest);
            GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0);
            GL.DeleteFramebuffer(renderTarget);

            return(dst);
        }
コード例 #4
0
 public TextureParameters GetParams()
 {
     return(ColorTexture.GetTextureParameters());
 }