How to write const array in GLSL ES
问题 I am trying to write a simple vertex shader for an OpenGL ES app on the iPhone, but my array constructor is causing me trouble. attribute vec4 normal; attribute vec4 position; void main(void){ const vec4 vertices[3] = vec4[](vec4(0.25, -0.25, 0.5, 1.0), vec4(-0.25, -0.25, 0.5, 1.0), vec4(0.25, 0.25, 0.5, 1.0)); gl_Position = vertices[gl_VertexID]; } When using this code the shader is unable to compile, and gives me the eror message: ERROR: 0:13: '(' : syntax error: Array size must appear