image.png
    2.Three.js - 图2
    2.Three.js - 图3
    (1)绘制2d图形
    2.Three.js - 图4

    1. attribute vec4 position;
    2. void main() {
    3. gl_Position = position;
    4. }

    (2)绘制3d图形
    2.Three.js - 图5

    1. attribute vec4 position;
    2. uniform mat4 matrix;
    3. void main() {
    4. gl_Position = position * matrix; // 使用矩阵matrix 将三维世界坐标转换成屏幕坐标
    5. }

    (3)光栅化,上色
    2.Three.js - 图6

    1. precision mediump float;
    2. void main(void) {
    3. gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);
    4. }