Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

108
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda