OpenGL ES 1 – Tutorial 5 – Draw Squares

Every shape we want to draw must be brought back into triangles, therefore OpenGL will draw the square with 2 triangles. The “indices” variable specifies the vertices to be taken from “vertices” for each triangle (counterclockwise). For the first triangle, pair of coordinates x,y: 0, 1 and 2, for the second triangle, pair of coordinates x,y: 2, 1 and 3.

OpenGL ES 1 – Tutorial 5 – Disegnare Quadrati

Ogni forma che vogliamo disegnare deve essere ricondotta in triangoli, quindi OpenGL disegnerà il quadrato tramite 2 triangoli. La variabile “indices” specifica i vertici da prendere da “vertices” per ogni triangolo (in senso antiorario). Per il primo triangolo, coppia coordinate x,y: 0, 1 e 2, per il secondo triangolo, coppia coordinate x,y: 2, 1 e 3.