Shader Learn

05 Data becomes vertices

Coordinate array → vertices

Eight vec3 rows define eight corners. So far there are only points, no surface.

Explanation

// JS - 8 corners, 3 numbers eachpositions = [  [-0.75, -0.75, 0.75], // p0  [ 0.75, -0.75, 0.75], // p1  [ 0.75,  0.75, 0.75], // p2  ...];
  1. 24 numbers
  2. 8 points

Uploaded as one continuous buffer of numbers; points do not join into faces by themselves.

JS sidegl.uniformMatrix4fv(uModel, …) // rotation -0.55 / 0.35

A model starts as a list of numbers in JS: every 3 numbers make one vertex.

Try it

  • Count the points: does it match the number of rows?