J'ai un vertex shader avec des attributs qui peuvent être définis ou non dans une trame donnée. Comment puis-je vérifier si ces attributs ont été définis ou non?GLSL - Vérification des attributs d'ensemble
Ce que je voudrais faire:
attribute vec3 position;
attribute vec3 normal;
attribute vec4 color;
attribute vec2 textureCoord;
uniform mat4 perspective;
uniform mat4 modelview;
uniform mat4 camera;
uniform sampler2D textureSampler;
varying lowp vec4 vColor;
void main() {
gl_Position = perspective * camera * modelview * vec4(position, 1.0);
if ((bool)textureCoord) { // syntax error
vColor = texture2D(textureSampler, textureCoord);
} else {
vColor = (bool)color ? color : vec4((normal.xyz + 1.0)/2.0 , 1.0);
}
}
Nous parlons de GL ES 2, je pressume? – Kos