コード例 #1
0
 public void DrawChain()
 {
     GL.BindVertexArray(arrayNum);
     GL.BindBuffer(BufferTarget.ArrayBuffer, bufferNum);
     GL.DrawArrays(PrimitiveType.Triangles, 0, numVerts);
     GLUtilities.ErrorCheck(string.Format("Drawing chain {0} + {1}", texture1, texture2));
 }
コード例 #2
0
        public void UpdateShader(Shader shader)
        {
            shader.UseShader();
            int cameraPos         = GL.GetUniformLocation(shader.shaderID, "cameraPos");
            int cameraOrientation = GL.GetUniformLocation(shader.shaderID, "cameraOrientation");
            int cameraDistance    = GL.GetUniformLocation(shader.shaderID, "cameraDistance");

            GL.Uniform3(cameraPos, ref position);
            GL.UniformMatrix4(cameraOrientation, false, ref orientation);
            GL.Uniform1(cameraDistance, distance);
            GLUtilities.ErrorCheck("Setting shader camera");
        }
コード例 #3
0
 public void InitBuffer(TextureChain source)
 {
     texture1  = source.texture1; texture2 = source.texture2;
     numVerts  = source.numVerts;
     bufferNum = GL.GenBuffer();
     arrayNum  = GL.GenVertexArray();
     GL.BindVertexArray(arrayNum);
     GL.BindBuffer(BufferTarget.ArrayBuffer, bufferNum);
     GL.BufferData(BufferTarget.ArrayBuffer, source.pointer * sizeof(float), source.vertBuffer, BufferUsageHint.StaticDraw);
     GLUtilities.ErrorCheck(string.Format("Uploading chain {0} + {1}", texture1, texture2));
     GL.EnableVertexAttribArray(0);
     GL.VertexAttribPointer(0, 3, VertexAttribPointerType.Float, false, sizeof(float) * 6, 0);
     GLUtilities.ErrorCheck(string.Format("Chain {0} + {1} Attrib 0", texture1, texture2));
     GL.EnableVertexAttribArray(1);
     GL.VertexAttribPointer(1, 3, VertexAttribPointerType.Float, false, sizeof(float) * 6, sizeof(float) * 3);
     GLUtilities.ErrorCheck(string.Format("Chain {0} + {1} Attrib 1", texture1, texture2));
 }