コード例 #1
0
ファイル: RScreen.cs プロジェクト: polytronicgr/reactor
        public void RenderTexture(RTexture texture, Math.Rectangle bounds, RColor color, Matrix matrix, bool font)
        {
            RViewport viewport = REngine.Instance._viewport;

            UpdateQuad(bounds);
            blendState.PlatformApplyState();

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

            defaultShader.Bind();
            defaultShader.SetSamplerValue(RTextureLayer.DIFFUSE, texture);
            vertexQuad2D.Bind();
            vertexQuad2D.BindVertexArray();
            indexQuad2D.Bind();


            defaultShader.SetUniformValue("projection", camera2d.Projection);
            defaultShader.SetUniformValue("view", camera2d.View);
            defaultShader.SetUniformValue("diffuse_color", color.ToVector4());
            defaultShader.SetUniformValue("model", matrix);
            defaultShader.SetUniformValue("font", font);
            vertexQuad2D.VertexDeclaration.Apply(defaultShader, IntPtr.Zero);


            GL.DrawElements(PrimitiveType.Triangles, indexQuad2D.IndexCount, DrawElementsType.UnsignedShort, IntPtr.Zero);
            REngine.CheckGLError();

            GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.DstAlpha);
            GL.Disable(EnableCap.Blend);
            indexQuad2D.Unbind();
            vertexQuad2D.UnbindVertexArray();
            vertexQuad2D.Unbind();
            defaultShader.Unbind();
        }
コード例 #2
0
ファイル: REngine.cs プロジェクト: polytronicgr/reactor
 public void EndHDR()
 {
     hdrFrameBuffer.Unbind();
     hdrShader.Bind();
     hdrShader.SetSamplerValue(RTextureLayer.DIFFUSE, hdrFrameBuffer);
     hdrShader.Unbind();
 }