public PostProcessingExample(int width, int height)
 {
     fbo = new FBO();
     textureForRendering = Texture.Create(width, height);
     shaderPostProcess = PixelShader.Create(Encoding.UTF8.GetString(Resources.Swirl));
     shaderSource = PixelShader.Create(Encoding.UTF8.GetString(Resources.PatternCircle));
 }
 public PingPongExample(int width, int height)
 {
     fbo = new FBO();
     textureA = Texture.Create(width, height);
     textureB = Texture.Create(width, height);
     active = textureA;
     shaderCopy = PixelShader.Create(PixelShader.Copy);
     shaderGameOfLife = PixelShader.Create(Encoding.UTF8.GetString(Resources.GameOfLife));
 }
示例#3
0
        public VisualContext()
        {
            GL.Disable(EnableCap.DepthTest);
            GL.ClearColor(1, 0, 0, 0);

            surface = new FBO();
            textureSurface = Texture.Create(1, 1);

            shaderCopyToScreen = InitShaderCopyToScreen();
            shaderDefault = InitShaderDefault();
        }
示例#4
0
        public Visual()
        {
            // Vertex positions
            float[] positions =
            {
                1.0f, -1.0f,
                1.0f, 1.0f,
                -1.0f, -1.0f,
                -1.0f, 1.0f
            };
            // Reserve a name for the buffer object.
            bufferQuad = GL.GenBuffer();
            // Bind it to the GL_ARRAY_BUFFER target.
            GL.BindBuffer(BufferTarget.ArrayBuffer, bufferQuad);
            // Allocate space for it (sizeof(positions)
            GL.BufferData(BufferTarget.ArrayBuffer
                , (IntPtr) (sizeof(float) * positions.Length), positions, BufferUsageHint.StaticDraw);

            GL.BindVertexArray(bufferQuad);
            GL.EnableClientState(ArrayCap.VertexArray);
            GL.VertexPointer(2, VertexPointerType.Float, 0, 0);
            GL.BindVertexArray(0);
            GL.BindBuffer(BufferTarget.ArrayBuffer, 0);

            GL.Disable(EnableCap.DepthTest);
            GL.ClearColor(1, 0, 0, 0);

            surface = new FBO();
            textureSurface = Texture.Create(1, 1);

            string sVertexShader = @"
                varying vec2 uv;
                void main() {
                    gl_Position = gl_Vertex;
                    uv = gl_Vertex.xy * 0.5f + 0.5f;
                }";
            string sFragmentShd = @"
            varying vec2 uv;
            uniform sampler2D tex;
            void main() {
                gl_FragColor = texture(tex, uv);
            }";
            shaderCopyToScreen = Shader.LoadFromStrings(sVertexShader, sFragmentShd);
            shader = new Shader();
            texture1 = new Texture();
            texture2 = new Texture();
        }
 public PostProcessing(int width, int height)
 {
     fbo = new FBO();
     texImage = Texture.Create(width, height);
     SetShader(ShaderCopy);
 }