Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

98
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!