View Full Version : finding out what call caused the INVALID_ENUM?

11-21-2010, 12:39 PM
Ive run into this issue + cant use gl.getError(); to narrow down my search of where its occuring, since it doesnt work correctly. hmm perhaps I can use glFinish();
Are there any debuggers for webGL like there is with opengl?

setup() {

// error is happening here somewhere

gl.getError(); // BUT no error gets reported here
setInterval(loop, 1000.0/60.0 );
gl.getError(); // no error
// no code after this

loop() {
gl.getError(); // error gets reported here

cheers zed

11-23-2010, 12:51 AM
Having getError directly after setInterval makes no sense, because loop() will be called asyncchronously after 1000.0/60.0 miliseconds.
For debugging javascript - you can use webinspector (for webkit) or firebug (for firefox - but I'm not sure if it's available for ff beta) - you can create breakpoint by writing
debugger; in js code

11-25-2010, 06:52 PM
thanks wglb for the reply, though i dont need to debug javascript but the actual gl commands i want to find out which one is causing the error

Having getError directly after setInterval makes no sense
yes i realize this, i was trying to make it clearer that the error is happening before this in the code

perhaps this is more easy to understand


// lotsa stuff

gl.getError(); // no error gets reported here

loop() {
gl.getError(); // error gets reported here
ive tried inserting a few glfinish() commands but still the same thing.

ive also tried the standard method of commenting out stuff to narrow down the command but no luck

11-26-2010, 12:21 AM
There is also complex debugging tool for webgl, but it doesn't work for me: viewtopic.php?f=43&t=3173 (http://www.khronos.org/message_boards/viewtopic.php?f=43&t=3173)

11-26-2010, 11:52 AM
thanks mate, Ill try that out, nice and small piece of code as well

11-26-2010, 12:20 PM
I cant edit my last post?
anyways, got it working which may help u get it working for you wglb

gl = WebGLDebugUtils.makeDebugContext(canvas.getContext ("experimental-webgl"));
// gl = canvas.getContext("experimental-webgl", { antialias: true });

stick an error in eg
gl.frontFace( 33 );

and in the console window u should see
WebGL error INVALID_ENUM in frontFace(*UNKNOWN WebGL ENUM (0x21))

unifortunately it does specify where in the code that call was made, but does narrow down the options lots