Exemplo n.º 1
0
 public static Comparison CompareTo(VertexShader left, string right)
 {
   int comparison = left.Id.CompareTo(right);
   if (comparison > 0)
     return Comparison.Greater;
   else if (comparison < 0)
     return Comparison.Less;
   else
     return Comparison.Equal;
 }
Exemplo n.º 2
0
 public static int CompareTo(VertexShader left, string right)
 {
     return left.Id.CompareTo(right);
 }
Exemplo n.º 3
0
        internal static void SetUpBuiltInShaders()
        {
            // Basic Vertex Shader
              int basicVertexShaderHandle = GL.CreateShader(ShaderType.VertexShader);
              GL.ShaderSource(basicVertexShaderHandle, VertexShader.Texture);
              GL.CompileShader(basicVertexShaderHandle);
              VertexShader basicVertexShader =
            new VertexShader("VertexShaderBasic", "Built-In", basicVertexShaderHandle);

              // Transform Vertex Shader
              int transformVertexShaderHandle = GL.CreateShader(ShaderType.VertexShader);
              GL.ShaderSource(transformVertexShaderHandle, VertexShader.Transform);
              GL.CompileShader(transformVertexShaderHandle);
              VertexShader transformVertexShader =
            new VertexShader("VertexShaderTransform", "Built-In", transformVertexShaderHandle);

              // Basic Fragment Shader
              int basicFragmentShaderHandle = GL.CreateShader(ShaderType.FragmentShader);
              GL.ShaderSource(basicFragmentShaderHandle, FragmentShader.Texture);
              GL.CompileShader(basicFragmentShaderHandle);
              FragmentShader basicFragmentShader =
            new FragmentShader("FragmentShaderBasic", "Built-In", basicFragmentShaderHandle);

              // Color Fragment Shader
              int colorFragmentShaderHandle = GL.CreateShader(ShaderType.FragmentShader);
              GL.ShaderSource(colorFragmentShaderHandle, FragmentShader.Color);
              GL.CompileShader(colorFragmentShaderHandle);
              FragmentShader colorFragmentShader =
            new FragmentShader("FragmentShaderBasic", "Built-In", colorFragmentShaderHandle);

              // Text Fragment Shader
              int textFragmentShaderHandle = GL.CreateShader(ShaderType.FragmentShader);
              GL.ShaderSource(textFragmentShaderHandle, FragmentShader.Text);
              GL.CompileShader(textFragmentShaderHandle);
              FragmentShader textFragmentShader =
            new FragmentShader("FragmentShaderBasic", "Built-In", textFragmentShaderHandle);

              // Make the default shader program
              int basicProgramHandle = GL.CreateProgram();
              GL.AttachShader(basicProgramHandle, basicVertexShader.GpuHandle);
              GL.AttachShader(basicProgramHandle, basicFragmentShader.GpuHandle);
              GL.LinkProgram(basicProgramHandle);
              _defaultShader = new ShaderProgram("ShaderProgramBasic", basicProgramHandle);
              Renderer.DefaultShaderProgram = _defaultShader;

              // Make the color shader program
              int colorProgramHandle = GL.CreateProgram();
              GL.AttachShader(colorProgramHandle, transformVertexShader.GpuHandle);
              GL.AttachShader(colorProgramHandle, colorFragmentShader.GpuHandle);
              GL.LinkProgram(colorProgramHandle);
              _colorShader = new ShaderProgram("ShaderProgramColor", colorProgramHandle);

              // Make the default shader program
              int textProgramHandle = GL.CreateProgram();
              GL.AttachShader(textProgramHandle, basicVertexShader.GpuHandle);
              GL.AttachShader(textProgramHandle, textFragmentShader.GpuHandle);
              GL.LinkProgram(textProgramHandle);
              _textShader = new ShaderProgram("ShaderProgramText", textProgramHandle);

              // Vertex Shader Light
              int vertexShaderLightHandle = GL.CreateShader(ShaderType.VertexShader);
              GL.ShaderSource(vertexShaderLightHandle, VertexShader.Light);
              GL.CompileShader(vertexShaderLightHandle);
              VertexShader vertexShaderLight =
            new VertexShader("VertexShaderLight", "Built-In", vertexShaderLightHandle);

              // Fragment Shader Light
              int fragmentShaderLightHandle = GL.CreateShader(ShaderType.FragmentShader);
              GL.ShaderSource(fragmentShaderLightHandle, FragmentShader.Light);
              GL.CompileShader(fragmentShaderLightHandle);
              FragmentShader fragmentShaderLight =
            new FragmentShader("FragmentShaderBasic", "Built-In", fragmentShaderLightHandle);

              // Shader Program Light
              int shaderProgramLightHandle = GL.CreateProgram();
              GL.AttachShader(shaderProgramLightHandle, vertexShaderLight.GpuHandle);
              GL.AttachShader(shaderProgramLightHandle, fragmentShaderLight.GpuHandle);
              GL.LinkProgram(shaderProgramLightHandle);
              _lightShader = new ShaderProgram("ShaderProgramLight", shaderProgramLightHandle);
        }
Exemplo n.º 4
0
 public static int CompareTo(VertexShader left, VertexShader right)
 {
     return left.Id.CompareTo(right.Id);
 }