Replies: 3 comments 6 replies
-
Here's working code:
Live: https://jsgist.org/?src=4f95e62f8d18a568856dbc45462675ce All I had to do was change the this
to a
normally I'd leave it off
|
Beta Was this translation helpful? Give feedback.
5 replies
-
the default `numComponents` is 3 for an array named "position". it doesn't have the info that position is a vec4. That info is not passed to createBufferInfoFromArrays and further it's irrelevant. You can use `numComponents` 1, 2, or 3 with a vec4 attribute. vec4 attributes default to 0,0,0,1 and whatever parts you don't provide will be set to those values
As for why 3, see docs on how it guesses the numComponents
https://twgljs.org/docs/module-twgl.html#.Arrays
|
Beta Was this translation helpful? Give feedback.
0 replies
-
Here TWGL.js example with colored triangle and comments https://jsfiddle.net/k68vw4x3/1/ |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I have this line of code:
https://git.sr.ht/~cgenie/webgl-tests/tree/master/item/hello-world/src/index.js#L97
This works and renders 2 triangles. However I tried hard and couldn't render only 1 triangle with
I tried manipulating
numComponents
and thecount
parameter intwgl.drawBufferInfo
here https://git.sr.ht/~cgenie/webgl-tests/tree/master/item/hello-world/src/index.js#L124.Beta Was this translation helpful? Give feedback.
All reactions