示例#1
0
        public Terreno()
        {
            cantidadDeVertices = GetVertices().Length / 5;
            cantidadDeIndices  = GetIndices().Length;

            bufferDeVertices = new VerticesBuffer(GetVertices(), GetVertices().Length *sizeof(float));
            bufferDeIndices  = new IndicesBuffer(GetIndices(), GetIndices().Length);

            shader = new Shader("d:/ginno/documents/visual studio 2017/Projects/Tarea1Grafica/Tarea1Grafica/shader/shader.vert", "d:/ginno/documents/visual studio 2017/Projects/Tarea1Grafica/Tarea1Grafica/shader/shader.frag");
            shader.use();

            textura = new Textura("d:/ginno/Documents/Visual Studio 2017/Projects/Tarea1Grafica/Tarea1Grafica/Recursos/cesped.jpg");
            textura.Use();

            //Creamos el VertexArrayObject (VAO)
            arregloDeVertices = new VerticesArreglo();
            //GL.BindVertexArray(arregloDeVertices);
            arregloDeVertices.enlazar();

            //Enlazamos de nuevo los buffers
            //GL.BindBuffer(BufferTarget.ArrayBuffer, bufferDeVertices.);
            bufferDeVertices.enlazar();
            //
            //GL.BindBuffer(BufferTarget.ElementArrayBuffer, bufferDeElementosIndices);
            bufferDeIndices.enlazar();

            arregloDeVertices.añadirBuffer(bufferDeVertices, shader);

            //Al inicializarse, se calcula aqui la matriz modelo
            CalcularMatrizModelo();
        }
示例#2
0
 public void draw(VerticesArreglo verticesArreglo, IndicesBuffer indicesBuffer, Shader shader)
 {
     shader.use();
     verticesArreglo.enlazar();
     indicesBuffer.enlazar();
     GL.DrawElements(PrimitiveType.Triangles, indicesBuffer.getCantidad(), DrawElementsType.UnsignedInt, 0);
 }
示例#3
0
        public Piramide()
        {
            cantidadDeVertices = 5;
            cantidadDeIndices  = 18;

            bufferDeVertices = new VerticesBuffer(GetVertices(), GetVertices().Length *sizeof(float));
            bufferDeIndices  = new IndicesBuffer(GetIndices(), GetIndices().Length);

            shader = new Shader("d:/ginno/documents/visual studio 2017/Projects/Tarea1Grafica/Tarea1Grafica/shader/shader.vert", "d:/ginno/documents/visual studio 2017/Projects/Tarea1Grafica/Tarea1Grafica/shader/shader.frag");
            shader.use();

            textura = new Textura("d:/ginno/Documents/Visual Studio 2017/Projects/Tarea1Grafica/Tarea1Grafica/Recursos/cesped.jpg");
            textura.Use();

            arregloDeVertices = new VerticesArreglo();
            arregloDeVertices.enlazar();
            bufferDeVertices.enlazar();
            bufferDeIndices.enlazar();

            arregloDeVertices.añadirBuffer(bufferDeVertices, shader);

            CalcularMatrizModelo();
        }