Project

General

Profile

Actions

Feature #1194

closed
TG

WGLWidget debugging

Feature #1194: WGLWidget debugging

Added by Tassilo Glander over 14 years ago. Updated over 14 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
Start date:
03/19/2012
Due date:
% Done:

0%

Estimated time:

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.

WD Updated by Wim Dumon over 14 years ago Actions #1

  • Status changed from New to Resolved

Will be included in Wt, thank you.

Wim.

KD Updated by Koen Deforche over 14 years ago Actions #2

  • Status changed from Resolved to Closed
  • Target version set to 3.2.1
Actions

Also available in: PDF Atom