Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webGL 学习总结 - 持续更新 #5

Open
zhouzhili opened this issue Jan 21, 2019 · 0 comments
Open

webGL 学习总结 - 持续更新 #5

zhouzhili opened this issue Jan 21, 2019 · 0 comments

Comments

@zhouzhili
Copy link
Owner

zhouzhili commented Jan 21, 2019

平移和缩放

  1. 需要掌握基本的矢量知识及相关运算方法

  2. 矢量运算中不满足乘法交换律,及 AxB 和 BxA 是不相等的,在设置变换矩阵时,应当设置为

// 点位
attribute vec4 aPosition;
// 变换矩阵
uniform mat4 uTranslateMatrix;
void main() {
  // 变换矩阵×点位矩阵
  gl_Position =uTranslateMatrix * aPosition;
}

要注意矩阵的位置,变换矩阵 × 点位矩阵

  1. gl.readPixels

readPixels

需要注意的是,前两个参数 x,y 代表的坐标系原点是 canvas 左下角,向上为 Y 轴正方向,向右为 X 轴正方形

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant