Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6865659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:04:53+00:00 2026-05-27T03:04:53+00:00

In GLSL-ES it’s possible to have arrays. For example, the GLSL ES Specification gives

  • 0

In GLSL-ES it’s possible to have arrays. For example, the GLSL ES Specification gives the following example of a uniform variable that’s an array:

uniform vec4 lightPosition[4];

Is it possible to have vertex attributes that are arrays? In other words, is the following legal according to the spec?

attribute vec4 foo[3];  // three vec4s per vertex

Is the answer (either yes or no) explicitly mentioned anywhere in the GLSL ES Specification? (I can’t find it, but I haven’t read every line of the spec.)

Also, if it is legal, how does one initialize such an attribute using the OpenGL ES 2.0 API? (Assuming glVertexAttribPointer would be used, what is the layout of the vertices/array-elements/vector-elements?)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T03:04:53+00:00Added an answer on May 27, 2026 at 3:04 am

    The GLSL ES 2.0 specification states that attributes cannot be declared as arrays.

    In desktop GL, you can have attribute arrays. When the attribute is assigned an attribute index (either with glBindAttribLocation or automatically by the shader being linked), it will get consecutive attributes, starting with the one you requested if you used glBindAttribLocation. So if foo was given the location 5, foo[0] would be 5, foo[1] would be 6, and foo[2] would be 7.

    If there is some ES 2.0 extension to allow attribute arrays, it would likely work like this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an GLSL geometry shader that looks like the following: #version 150 uniform
I have this shader code (GLSL): #version 420 in vec4 vertex; uniform mat4 modelViewMatrix;
I have the following GLSL code: uniform mat3x3 rgb2xyz = mat3x3( vec3(DEFAULT_RGB2XYZ_XR, DEFAULT_RGB2XYZ_XG, DEFAULT_RGB2XYZ_XB),
I have read that GLSL (specifically v1.0.17: my application is running under WebGL) compilers
Is it possible to write GLSL ES fragment shaders under iOS that generate multiple
Is it possible in desktop GLSL to pass a fixed size array of floats
I have some GLSL shaders that are compiling correctly, and being successfully attached to
Suppose I have 5 GLSL shaders that I successfully loaded in my opengl program.
I have an OpenGL-program using GLSL, that I can run just fine with the
The GLSL specification states, for the coherent memory qualifier: memory variable where reads and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.