{"action":"created","issue":{"url":"https://api.github.com/repos/regl-project/regl/issues/373","repository_url":"https://api.github.com/repos/regl-project/regl","labels_url":"https://api.github.com/repos/regl-project/regl/issues/373/labels{/name}","comments_url":"https://api.github.com/repos/regl-project/regl/issues/373/comments","events_url":"https://api.github.com/repos/regl-project/regl/issues/373/events","html_url":"https://github.com/regl-project/regl/issues/373","id":186738093,"number":373,"title":"Handle vec* types in uniform arrays","user":{"login":"sansumbrella","id":81553,"avatar_url":"https://avatars.githubusercontent.com/u/81553?v=3","gravatar_id":"","url":"https://api.github.com/users/sansumbrella","html_url":"https://github.com/sansumbrella","followers_url":"https://api.github.com/users/sansumbrella/followers","following_url":"https://api.github.com/users/sansumbrella/following{/other_user}","gists_url":"https://api.github.com/users/sansumbrella/gists{/gist_id}","starred_url":"https://api.github.com/users/sansumbrella/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sansumbrella/subscriptions","organizations_url":"https://api.github.com/users/sansumbrella/orgs","repos_url":"https://api.github.com/users/sansumbrella/repos","events_url":"https://api.github.com/users/sansumbrella/events{/privacy}","received_events_url":"https://api.github.com/users/sansumbrella/received_events","type":"User","site_admin":false},"labels":[{"id":330347946,"url":"https://api.github.com/repos/regl-project/regl/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-11-02T08:25:25Z","updated_at":"2016-11-02T22:46:31Z","closed_at":null,"body":"I have a fragment shader with an array uniform of vec2s.\r\n```\r\nuniform vec2 laplace_offsets[9];\r\n```\r\n\r\nI would expect to be able to fill this with a uniform like so:\r\n```\r\n  uniforms: {\r\n    laplace_offsets: [[-1, -1], [0, -1], [1, -1],\r\n                       [-1, 0], [0, 0], [1, 0],\r\n                       [-1, 1], [0, 1], [1, 1]]\r\n  }\r\n```\r\n\r\nHowever, the above results in an invalid uniform error: `invalid uniform laplace_offsets in command`.\r\n\r\nIf I manually flatten the offsets array, then regl complains that I should specify a length 2 in the command (presumably for `glUniform2fv`).  `regl.js:49 Error: (regl) bad data or missing for uniform \"laplace_offsets[0]\".  invalid vector, should have length 2 in command`. Given that error, I would expect there to be a way to specify the length of my uniforms. Perhaps there is one that is undocumented?\r\n\r\nI took a guess with the following (with and without manually flattening the data array), but it didn't pan out:\r\n```\r\nuniforms: {\r\n  laplace_offsets: {\r\n    data: [[-1, -1], [0, -1], [1, -1],\r\n                       [-1, 0], [0, 0], [1, 0],\r\n                       [-1, 1], [0, 1], [1, 1]],\r\n    length: 2\r\n  }\r\n}\r\n```\r\n\r\nHaving an API like the above might also help resolve ambiguity for issues like #258.\r\n"},"comment":{"url":"https://api.github.com/repos/regl-project/regl/issues/comments/258022690","html_url":"https://github.com/regl-project/regl/issues/373#issuecomment-258022690","issue_url":"https://api.github.com/repos/regl-project/regl/issues/373","id":258022690,"user":{"login":"vorg","id":171001,"avatar_url":"https://avatars.githubusercontent.com/u/171001?v=3","gravatar_id":"","url":"https://api.github.com/users/vorg","html_url":"https://github.com/vorg","followers_url":"https://api.github.com/users/vorg/followers","following_url":"https://api.github.com/users/vorg/following{/other_user}","gists_url":"https://api.github.com/users/vorg/gists{/gist_id}","starred_url":"https://api.github.com/users/vorg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vorg/subscriptions","organizations_url":"https://api.github.com/users/vorg/orgs","repos_url":"https://api.github.com/users/vorg/repos","events_url":"https://api.github.com/users/vorg/events{/privacy}","received_events_url":"https://api.github.com/users/vorg/received_events","type":"User","site_admin":false},"created_at":"2016-11-02T22:46:31Z","updated_at":"2016-11-02T22:46:31Z","body":"What's the reported type of `laplace_offsets[0]`? Is that `vec3`? What about checking for `[` in the name? Is that to much of a hack?"}}
{"actor":{"display_login":"vorg"}}