2
基本上我想创建一个包含我的顶点着色器以及片段着色器的文件。如何在OpenGL/GLES着色器中添加指令?
这样子。
#ifdef VERTEX
attribute vec4 a_pos;
attribute vec2 a_texCoords;
uniform mat4 combined;
varying vec2 v_texCoords;
void main(){
v_texCoords = a_texCoords;
gl_Position = combined * a_pos;
}
#endif
#ifdef FRAGMENT
varying vec2 v_texCoords;
uniform sampler2D u_texture;
void main() {
gl_FragColor = texture2D(u_texture, v_texCoords);
//gl_FragColor = vec4(1,0,0,1);
}
#endif
但是如何在编译像c/C++中的make_file这样的着色器时传递指令?用它作为顶点着色器源代码时使用它作为片段着色器的源代码
这样当