예제 #1
0
        public BrickShader(GraphicsInterface gi)
            : base(gi)
        {
            //Console.WriteLine("BrickShader Link Log: \n{0}", InfoLog);
            GLSLVertexShader vShader = new GLSLVertexShader(gi, Brick_VertexSource);
            AttachShader(vShader);


            GLSLFragmentShader fShader = new GLSLFragmentShader(gi, Brick_FragmentSource);
            AttachShader(fShader);

            Link();

            // Do an initial selection so that all the variables can be located
            Bind();

            BrickColor_Pos = GetUniformLocation("BrickColor");
            MortarColor_Pos = GetUniformLocation("MortarColor");
            BrickSize_Pos = GetUniformLocation("BrickSize");
            BrickPct_Pos = GetUniformLocation("BrickPct");
            
            // From the Vertex Shader
            LightPosition_Pos = GetUniformLocation("LightPosition");

            // Set some initial values
            BrickColor = new ColorRGBA(1.0f, 0.3f, 0.2f);
            MortarColor = new ColorRGBA(0.85f, 0.86f, 0.84f);
            BrickSize = new float2(0.30f, 0.15f);
            BrickPct = new float2(0.90f, 0.85f);
            LightPosition = new Vector3f(0.0f, 0.0f, 4.0f);

            // Unselect so we start in an unselected state
            Unbind();
        }
예제 #2
0
        public BrightnessShader(GraphicsInterface gi)
            : base(gi)
        {
            GLSLVertexShader vShader = new GLSLVertexShader(gi, Brightness_VertexSource);
            vShader.Compile();
            string tmpString = vShader.InfoLog;

            GLSLFragmentShader fShader = new GLSLFragmentShader(gi, Brightness_FragmentSource);
            fShader.Compile();
            tmpString = fShader.InfoLog;

            Link();
            // Setup variables
            bool isProgram = IsProgram;
            bool isValid = IsValid;

            Bind();
            Alpha_Pos = GetUniformLocation("bright");
            TextureID_Pos = GetUniformLocation("texture");
            Unbind();
        }