Beispiel #1
0
        public void DrawTexture(ITexture texture, ISampler sampler, Extents2DF srcRegion, Extents2DF dstRegion)
        {
            if (texture is TextureView srcTexture)
            {
                SupportBufferUpdater.Commit();

                var oldCullMode          = _newState.CullMode;
                var oldStencilTestEnable = _newState.StencilTestEnable;
                var oldDepthTestEnable   = _newState.DepthTestEnable;
                var oldDepthWriteEnable  = _newState.DepthWriteEnable;
                var oldTopology          = _newState.Topology;
                var oldViewports         = _dynamicState.Viewports;
                var oldViewportsCount    = _newState.ViewportsCount;

                _newState.CullMode          = CullModeFlags.CullModeNone;
                _newState.StencilTestEnable = false;
                _newState.DepthTestEnable   = false;
                _newState.DepthWriteEnable  = false;
                SignalStateChange();

                Gd.HelperShader.DrawTexture(
                    Gd,
                    this,
                    srcTexture,
                    sampler,
                    srcRegion,
                    dstRegion);

                _newState.CullMode          = oldCullMode;
                _newState.StencilTestEnable = oldStencilTestEnable;
                _newState.DepthTestEnable   = oldDepthTestEnable;
                _newState.DepthWriteEnable  = oldDepthWriteEnable;
                _newState.Topology          = oldTopology;

                _dynamicState.Viewports      = oldViewports;
                _dynamicState.ViewportsCount = (int)oldViewportsCount;
                _dynamicState.SetViewportsDirty();

                _newState.ViewportsCount = oldViewportsCount;
                SignalStateChange();
            }
        }
Beispiel #2
0
        public void DrawTexture(ITexture texture, ISampler sampler, Extents2DF srcRegion, Extents2DF dstRegion)
        {
            if (texture is TextureView view && sampler is Sampler samp)
            {
                _supportBuffer.Commit();

                if (HwCapabilities.SupportsDrawTexture)
                {
                    GL.NV.DrawTexture(
                        view.Handle,
                        samp.Handle,
                        dstRegion.X1,
                        dstRegion.Y1,
                        dstRegion.X2,
                        dstRegion.Y2,
                        0,
                        srcRegion.X1 / view.Width,
                        srcRegion.Y1 / view.Height,
                        srcRegion.X2 / view.Width,
                        srcRegion.Y2 / view.Height);
                }
                else
                {