WebGLSamples / WebGL2Samples

Short and easy to understand samples demonstrating WebGL 2 features
Other
1.01k stars 143 forks source link

Draw range arrays #19

Closed shrekshao closed 8 years ago

shrekshao commented 8 years ago

Getting rid of UBO cause I can't get it work correctly within a short time.

But the sample is enough to demonstrate the feature: draw range arrays.

pjcozzi commented 8 years ago

@shrekshao merge in master so this can be auto-merged.

@trungtle let me know when you are happy with this, and I will review.

pjcozzi commented 8 years ago

What is the point of this sample? How is it different than the instancing sample?

shrekshao commented 8 years ago

void drawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount)

with different GLint first, draw arrays start with an offset in the vertex array. So the two rects are using different vertex pos data, comparing to instancing, using the same set of vertex array.

pjcozzi commented 8 years ago

Ah, OK. Are you sure about the sample name? I think people are going to confuse it with drawRangeElements, which will likely not be part of WebGL 2.

shrekshao commented 8 years ago
pjcozzi commented 8 years ago

We'll keep the name, but if folks get confused, we can consider a rename to something like draw_instanced_first.