3

I´m coding my own webGL engine/framework, but something weird is happening:
I´m drawing a simple plane (2 triangles, just for testing) geometry with

gl.drawElements( drawMode , geometry.numItems , gl.UNSIGNED_SHORT , 0 ) ;
where drawmode is a variable with gl.TRIANGLES stored,
and geometry.numItems is the length of indices array.
All other buffers and stuff is properly set. In fact the object renders OK...

but cheking the debuging trace with webGL inspector in chrome I always see the error
" drawElements( TRIANGLES, 6 , UNSIGNED_SHORT , 0 ) " as INVALID_ENUM.
With this geometry and with any other.

screenshot from webGL inspector showing the problem
So I don't understand what is going so wrong here, and why if something is going so wrong the obejcts are rendering ok.
Any idea ?

Addicted
  • 1,568
  • 1
  • 15
  • 24
JGodo
  • 43
  • 5
  • Does it behave any differently if you put `gl.TRIANGLES` in directly, rather than the cached value? I really doubt that it would, but that's the only thing that comes to mind right away. – Toji May 15 '12 at 23:12
  • It might not be that instruction it itself that is the root of the problem - it could be, for example, that you've bound an incorrect buffer. Not sure, but worth a look. Can you post the entire code leading up to the draw? – MikaelEmtinger May 16 '12 at 06:04

0 Answers0