private void Render(Rectangle R) { if (program == 0) { program = PreloadShaders(); GLES32.GlEnable(GLES32.GlVertexArray); GLES32.GlGenVertexArrays(1, VAO, 0); GLES32.GlBindVertexArray(VAO[0]); GLES32.GlGenBuffers(1, VBO, 0); GLES32.GlBindBuffer(GLES32.GlArrayBuffer, VBO[0]); GLES32.GlBufferData(GLES32.GlArrayBuffer, vertices.Length * sizeof(float), buffer, GLES32.GlStaticDraw); int posloc = GLES32.GlGetAttribLocation(program, "Position"); GLES32.GlVertexAttribPointer(posloc, 3, GLES32.GlFloat, false, 0, 0); GLES32.GlEnableVertexAttribArray(posloc); GLES32.GlGenBuffers(1, IBO, 0); GLES32.GlBindBuffer(GLES32.GlElementArrayBuffer, IBO[0]); GLES32.GlBufferData(GLES32.GlElementArrayBuffer, inds.Length * sizeof(byte), ibuffer, GLES32.GlStaticDraw); GLES32.GlBindBuffer(GLES32.GlElementArrayBuffer, 0); GLES32.GlBindBuffer(GLES32.GlArrayBuffer, 0); GLES32.GlBindVertexArray(0); GLES32.GlUseProgram(program); } GLES32.GlClearColor(0, 0, 0, 1); GLES32.GlClear(GLES32.GlColorBufferBit | GLES32.GlDepthBufferBit); GLES32.GlViewport(0, 0, (int)(GLView.Width * 3), (int)(GLView.Height * 3)); GLES32.GlLineWidth(50); int scaleLocation = GLES32.GlGetUniformLocation(program, "gScale"); //scale = (scale + 0.005f) % 1; GLES32.GlUniform1f(scaleLocation, scale); /*int colorLocation = GLES32.GlGetUniformLocation(program, "color"); * red = (float)((red + 0.005f) % (2.0 * Math.PI)); * GLES32.GlUniform4f(colorLocation, (float)Math.Abs(Math.Sin(red)), 0, 0, 1);*/ int worldLocation = GLES32.GlGetUniformLocation(program, "world"); //Matrix.TranslateM(mat, 0, 0f, 0f, 0f); Matrix.RotateM(mat, 0, 1 * rotateSide, 0, 0, 1); //Matrix.TranslateM(mat, 0, 0f, 0f, 0f); GLES32.GlUniformMatrix4fv(worldLocation, 1, true, mat, 0); GLES32.GlBindVertexArray(VAO[0]); GLES32.GlBindBuffer(GLES32.GlElementArrayBuffer, IBO[0]); GLES32.GlDrawElements(GLES32.GlTriangles, 6, GLES32.GlUnsignedByte, 0); //GLES32.GlBindBuffer(GLES32.GlArrayBuffer, VBO[0]); //GLES32.GlDrawArrays(GLES32.GlTriangleFan, 0, 7); GLES32.GlFinish(); }