Example #1
0
        protected override void DoInitialize()
        {
            base.DoInitialize();

            {
                var bitmap = new Bitmap(width, height);
                using (var g = Graphics.FromImage(bitmap))
                {
                    g.Clear(Color.Red);
                    g.DrawString("CSharpGL", new Font("宋体", 88F), new SolidBrush(Color.Gold), new PointF(0, height / 2));
                }
                {
                    this.inTexture = this.GetTexture(bitmap);
                }
                {
                    var storage = new TexStorage2D(TexStorage2D.Target.Texture2D, GL.GL_RGBA32F, width, height, 8);
                    var texture = new Texture(storage);
                    texture.Initialize();

                    this.outTexture = texture;
                }

                bitmap.Dispose();
            }
        }
Example #2
0
        private void InitIntermediateTexture()
        {
            var storage = new TexStorage2D(TexStorage2D.Target.Texture2D, GL.GL_RGBA32F, 8, width, height);
            var texture = new Texture(storage);

            texture.Initialize();

            this.intermediateTexture = texture;
        }
Example #3
0
        private void InitFinalTexture()
        {
            var storage = new TexStorage2D(TexStorage2D.Target.Texture2D, GL.GL_RGBA32F, 8, width, height);
            var texture = new Texture(TextureTarget.Texture2D, storage);

            texture.Initialize();

            this.finalTexture = texture;
        }
Example #4
0
 protected override void DoInitialize()
 {
     base.DoInitialize();
     {
         this.GroupX = 1;
         this.GroupY = 1;
         this.GroupZ = 1;
     }
     {
         // This is the texture that the compute program will write into
         var storage = new TexStorage2D(TexStorage2D.Target.Texture2D, GL.GL_RGBA32F, 8, 256, 256);
         var texture = new Texture(storage);
         texture.Initialize();
         this.outputTexture = texture;
     }
     {
         RenderMethod  method  = this.RenderUnit.Methods[2];
         ShaderProgram program = method.Program;
         program.SetUniform("output_image", this.outputTexture);
     }
 }
Example #5
0
        private static void Load_VERSION_4_2()
        {
            DrawArraysInstancedBaseInstance              = GetAddress <DrawArraysInstancedBaseInstance>("glDrawArraysInstancedBaseInstance");
            _DrawElementsInstancedBaseInstance           = GetAddress <DrawElementsInstancedBaseInstance>("glDrawElementsInstancedBaseInstance");
            _DrawElementsInstancedBaseVertexBaseInstance = GetAddress <DrawElementsInstancedBaseVertexBaseInstance>("glDrawElementsInstancedBaseVertexBaseInstance");
            GetInternalformati             = GetAddress <GetInternalformati>("glGetInternalformativ");
            GetInternalformativ            = GetAddress <GetInternalformativ>("glGetInternalformativ");
            GetActiveAtomicCounterBufferi  = GetAddress <GetActiveAtomicCounterBufferi>("glGetActiveAtomicCounterBufferiv");
            GetActiveAtomicCounterBufferiv = GetAddress <GetActiveAtomicCounterBufferiv>("glGetActiveAtomicCounterBufferiv");
            BindImageTexture = GetAddress <BindImageTexture>("glBindImageTexture");
            MemoryBarrier    = GetAddress <MemoryBarrier>("glMemoryBarrier");
            TexStorage1D     = GetAddress <TexStorage1D>("glTexStorage1D");
            TexStorage2D     = GetAddress <TexStorage2D>("glTexStorage2D");
            TexStorage3D     = GetAddress <TexStorage3D>("glTexStorage3D");
            DrawTransformFeedbackInstanced       = GetAddress <DrawTransformFeedbackInstanced>("glDrawTransformFeedbackInstanced");
            DrawTransformFeedbackStreamInstanced = GetAddress <DrawTransformFeedbackStreamInstanced>("glDrawTransformFeedbackStreamInstanced");

            VERSION_4_2 = VERSION_4_1 && DrawArraysInstancedBaseInstance != null && _DrawElementsInstancedBaseInstance != null &&
                          _DrawElementsInstancedBaseVertexBaseInstance != null && GetInternalformati != null && GetInternalformativ != null &&
                          GetActiveAtomicCounterBufferi != null && GetActiveAtomicCounterBufferiv != null && BindImageTexture != null &&
                          MemoryBarrier != null && TexStorage1D != null && TexStorage2D != null && TexStorage3D != null &&
                          DrawTransformFeedbackInstanced != null && DrawTransformFeedbackStreamInstanced != null;
        }