-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GLOW.ShaderUtils.createMultiple only supports triangles #5
Comments
Good point! (pun intended) |
...or not. You need to know what type (TRIANGLE etc.) to draw. Any suggestions on how to set this up in a nice, consistent maner? |
Ok, I did like this now... in the shader config object, set the length as a number where elements used to be. For example... myShaderConfig = { ...to use drawArrays for 10 triangles. Side note: I've also added .offset to GLOW.Elements (which is still used in the drawArray case, just that its .elements is undefined) so you can offset or set the first when drawing. If you have a better idea on how to handle this, please let me know - I'm all ears :) |
Thanks for the quick update! I should probably have better things to do than creating issues on Xmas day ;) Hopefully DrawArrays isn't using 16 bit indices under the hood otherwise the 65536 limit will still be there, will give it a go. Off the top of my head, coming from OpenGL, I might have done something like this... IndexedmyShaderConfig = {
indices: myIndices,
data: {
vertices: myVerts,
primitive: GL.TRIANGLES
}
} Non-indexedmyShaderConfig = {
data: {
vertices: myVerts,
primitive: GL.TRIANGLES
}
} ...where primitive defaults to something (maybe triangles), and if there's no index array then it just works out what to do from the size of the vertex array. Will have a think about it some more. Happy holidays! |
I should, too, but things like these are just too much fun :) Yeah, I was thinking about figuring out the length using one of the attributes but I thought the ability to set the amount was nice. Now I think about it, you're probably right - most times you're not interested in setting the length but just get them all drawn. I'd look into changing into... IndexedmyShaderConfig = {
indices: myIndices, // the 'indices' property could also be triangles/points/etc and then you don't have to define...
primitive: GL.POINTS, // if left out, defaults to GL.TRIANGLES
data: {
// attributes and uniforms
}
}; Non-IndexedmyShaderConfig = {
primitive: GL.POINTS, // if left out, defaults to GL.TRIANGLES
data: {
// attributes and uniforms
}
}; Thanks for the input! (BTW: if you publish anything using GLOW, please let me know!) |
Ok, done. Please pull. And read the latest post on http://i-am-glow.com :D |
Changes look great! Thanks for the mention on the blog :) Will let you know when I get around to publishing something... |
GLOW.ShaderUtils.createMultiple doesn't work for points. As far as I can see Glow only deals with indexed rendering, i.e. glDrawElements rather than glDrawArrays. For drawing points, glDrawArrays would may be better anyway, as there wouldn't be shared vertices. This function would then no longer be necessary as the limitation is on the size of the data type of the index array.
The text was updated successfully, but these errors were encountered: