public void init(float[] vertice, uint[] indice, Color4 color) { this.vertices = vertice; this.indices = indice; this.color = color; VertexBufferObject = GL.GenBuffer(); ElementBufferObject = GL.GenBuffer(); VertexArrayObject = GL.GenVertexArray(); GL.BindVertexArray(VertexArrayObject); ////habilitamos el VA0 //enlaza VBO con buffer GL.BindBuffer(BufferTarget.ArrayBuffer, VertexBufferObject); GL.BufferData(BufferTarget.ArrayBuffer, vertices.Length * sizeof(float), vertices, BufferUsageHint.StaticDraw); //enlaza el ebo con el buffer GL.BindBuffer(BufferTarget.ElementArrayBuffer, ElementBufferObject); GL.BufferData(BufferTarget.ElementArrayBuffer, indices.Length * sizeof(uint), indices, BufferUsageHint.StaticDraw); GL.VertexAttribPointer(0, 3, VertexAttribPointerType.Float, false, 3 * sizeof(float), 0); GL.EnableVertexAttribArray(0); setShader(); shader.setColor(color); Vector3 position = new Vector3(3.0f, 0.0f, 3.0f);//posicion de camara Vector3 front = new Vector3(0.0f, 0.0f, 0.0f); Vector3 up = new Vector3(0.0f, 1.0f, 0.0f); view = Matrix4.LookAt(position, /*position + */ front, up); model = Matrix4.CreateRotationZ(MathHelper.DegreesToRadians(0)); //rotacion translation = Matrix4.CreateTranslation(0.0f, 0.0f, 0.0f); escala = 45; rotacion = false; traslacion = false; escalacion = false; casa = true; }
public void setterColor(Color4 color) { this.color = color; shader.setColor(color); }