Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

99
Vistas
GLSL know uniform array length

Basically what I have in my shader is a uniform vec2 array which gets its value in JS app. I need to know the length of this array in order to act accordingly. I tried array.length(), which gives me this error:

ERROR: 0:48: '' : methods supported in GLSL ES 3.00 and above only

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

In the JS side you can use getActiveUniform to receive WebGLActiveInfo as a result for each uniform. Each has a size field. According to the referenced page:

The size attribute of the return value corresponds to the length of the array for uniforms declared as arrays. Otherwise, it is 1 (this includes interface blocks instanced with arrays).

Something like this:

const max_uniforms = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS);
for (let i = 0; i < max_uniforms; i++) 
{
  const uniform_info = gl.getActiveUniform(program, i);
  console.log("uniform " + uniform_info.name + " length is " + uniform_info.size);
}
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda