drawElements with one point

I tried to write a unit test that draws a single point with drawElements (obviously, this is not production), and have found that a count of at least 2, not 1, is required for it to render. I see offset and stride requirements in the spec, but nothing related to count.

For example, the following code doesn’t render the point:

var buffer = gl.createBuffer();
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, buffer);
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, new Uint16Array([0, 0]), gl.STATIC_DRAW);
gl.drawElements(gl.POINTS, 1, _gl.UNSIGNED_SHORT, 0);

But the following drawElements does:

gl.drawElements(gl.POINTS, 2, _gl.UNSIGNED_SHORT, 0);

No GL errors are given. I tried with both unsigned byte and unsigned short on Chrome and Firefox with a Radeon HD 5870.

I have an easy workaround for my unit test, but wanted to see if I am missing something obvious.


Sounds like a bug.

I would do a couple of things:

  1. If possible, try it on different graphics cards…is it just a Radeon driver bug?
  2. Log the bug on both Chrome and Mozilla bug trackers.

Looks like I got my cards mixed up. It works with the Radeon, but does not work with an NVIDIA GeFoce 8800 GTS (with updated drivers). I’ll see about filing a bug.