Exemple #1
0
        private void Uniform2iv(int location, int count, int[] value)
        {
            if (location < 0 || value == null || value.Length != 2)
            {
                return;
            }

            ShaderProgram program = this.currentShaderProgram;

            if (program == null)
            {
                SetLastError(ErrorCode.InvalidOperation); return;
            }
            // TODO:GL_INVALID_OPERATION is generated if the size of the uniform variable declared in the shader does not match the size indicated by the glUniform command.
            if (count < 0)
            {
                SetLastError(ErrorCode.InvalidValue); return;
            }

            UniformVariable v = program.GetUniformVariable(location);

            if (v == null)
            {
                SetLastError(ErrorCode.InvalidOperation); return;
            }
            FieldInfo fieldInfo = v.fieldInfo;

            if ((count > 1) && (!fieldInfo.FieldType.IsArray))
            {
                SetLastError(ErrorCode.InvalidOperation); return;
            }

            var copy = new ivec2[count];

            for (int i = 0; i < count; i++)
            {
                copy[i] = new ivec2(value[i * 2 + 0], value[i * 2 + 1]);
            }
            program.SetUniform(location, copy);
        }
Exemple #2
0
 public static vec4 imageStore(image2D tex, ivec2 coord, vec4 value)
 {
     throw new NotImplementedException();
 }
Exemple #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="xy"></param>
 /// <param name="z"></param>
 public ivec3(ivec2 xy, int z)
 {
     this.x = xy.x;
     this.y = xy.y;
     this.z = z;
 }
 public static ivec4 ivec4(ivec2 xy, int z, int w)
 {
     return(new ivec4(xy.x, xy.y, z, w));
 }
 public static ivec4 ivec4(int x, int y, ivec2 zw)
 {
     return(new ivec4(x, y, zw.x, zw.y));
 }
 public static ivec4 ivec4(ivec2 xy, ivec2 zw)
 {
     return(new ivec4(xy.x, xy.y, zw.x, zw.y));
 }
 public static ivec3 ivec3(int x, ivec2 yz)
 {
     return(new ivec3(x, yz.x, yz.y));
 }
 public static ivec3 ivec3(ivec2 xy, int z)
 {
     return(new ivec3(xy.x, xy.y, z));
 }