Feature #1194
closedWGLWidget debugging
0%
Description
Hi,
I would like to propose a small modification to debug WebGL calls.
Currently, you have a GLDEBUG macro doing the getError() thing that is deactivated using an #IFDEF by default. This requires recompiling WT if you want to toggle debugging.
I suggest to use an additional static variable of WGLWidget to toggle this behavior. I understand that it is desirable to remove the debug code completely from the binary, so I still encapsulate it in the preprocessor IFDEF. I moved the definition into the
WGLWidget class:
WGLWidget.h
// ... inside WGLWidget class
// Enable or disable inclusion of WebGL debug code
#DEFINE WEBGL_DEBUGGING
#if WEBGL_DEBUGGING
// WebGL debugging using getError() after each WebGL call
private:
static bool gldebugging_;
public:
// Enable WebGL debugging
static void EnableGLCheckErrors(const bool enable){gldebugging_=enable;}
#define GLDEBUG if(gldebugging_){do {js_ << "\t\t{var err = ctx.getError(); if(err != ctx.NO_ERROR) {alert('error " << __FUNCTION__ << ": ' + err); debugger;}}\n";} while(false);}
#else
#define GLDEBUG
#endif
WGLWidget.c
#if WEBGL_DEBUGGING
// deactivate per default
bool WGLWidget::gldebugging_=false;
#endif
This way you can set toggle debug checks from external applications without recompiling Wt. Still, for a deploy version, you can undefine the WEBGL_DEBUGGING and no debug code is included at all.
Updated by Wim Dumon over 12 years ago
- Status changed from New to Resolved
Will be included in Wt, thank you.
Wim.
Updated by Koen Deforche over 12 years ago
- Status changed from Resolved to Closed
- Target version set to 3.2.1