[]2d 自定义shader
如何给v_testValue 赋值
//顶点着色器程序和片元着色器程序。
let vs: string = `attribute vec2 position;
attribute vec2 texcoord;
attribute vec4 color;
uniform vec2 size;
uniform mat4 mmat;
varying vec2 v_texcoord;
varying vec4 v_color;
varying float v_testValue;
void main(){
vec4 pos =mmat*vec4(position.x,position.y,0,1);
gl_Position = vec4((pos.x/size.x-0.5)*2.0, (0.5-pos.y/size.y)*2.0, pos.z, 1.0);
v_color = color;
v_texcoord = texcoord;
}`
//顶点着色器程序和片元着色器程序。
let vs: string = `attribute vec2 position;
attribute vec2 texcoord;
attribute vec4 color;
uniform vec2 size;
uniform mat4 mmat;
varying vec2 v_texcoord;
varying vec4 v_color;
varying float v_testValue;
void main(){
vec4 pos =mmat*vec4(position.x,position.y,0,1);
gl_Position = vec4((pos.x/size.x-0.5)*2.0, (0.5-pos.y/size.y)*2.0, pos.z, 1.0);
v_color = color;
v_texcoord = texcoord;
}`
没有找到相关结果
已邀请:
1 个回复
Aar0n
赞同来自: