Project

General

Profile

WGLWidget and progressive bootstrap

Added by Markus Raabe over 6 years ago

I was searching why all my webbrowsers were showing the message "Your browser does not support WebGL".

The reason I finally found was, that WGLWidget does not work in case progressive bootstrap is enabled. If I disable progressive bootstrap it works. (Wt 4.0 over fcgi is used)

Does it have to be that way? If I remember correctly, I originally enabled progressive bootstrap so that search engines see the page.

Another issue is also resolved by disabling progressive bootstrap: WPaintedWidget does not always use PNG for rendering but Canvas or SVG.

For WPaintedWidget and progressive bootstrap I had overridden the painting method to avoid PNG. Is there a similar way to get WebGL working with progressive bootstrap?


Replies (4)

RE: WGLWidget and progressive bootstrap - Added by Roel Standaert over 6 years ago

Yeah, that's something where WGLWidget could still be improved. When the WGLWidget is constructed, we can't know if WebGL support is available yet when using progressive bootstrap. It should actually rerender itself. We work around this in the widget gallery by disabling progressive bootstrap for certain paths, see examples/widgetgallery/approot/wt_config.xml. I'll check to see if there's an issue for it already, and make it if it doesn't exist.

I'm not sure how to best handle the WPaintedWidget case. We could also update that to the Canvas version once JavaScript support becomes apparent, but then there will of course be a bit of wasted effort because then both the PNG is generated, and then it is later redrawn with Canvas.

What you can also do in any case is delay the creation of those widgets by checking for WEnvironment::ajax(), and by overriding enableAjax(), so you don't create WGLWidgets or WPaintedWidgets until JavaScript support has been detected.

Regards,

Roel

RE: WGLWidget and progressive bootstrap - Added by Roel Standaert over 6 years ago

Note: I made an issue here: https://redmine.webtoolkit.eu/issues/6098

I did mark it as low priority, though.

Regards,

Roel

RE: WGLWidget and progressive bootstrap - Added by Markus Raabe over 6 years ago

Thanks.

Regarding WPaintedWidget: Maybe the initial PNG can be kept until the image is updated. The updated image could be generated using the recommended method after progressive bootstrap.

Best regards

Markus

RE: WGLWidget and progressive bootstrap - Added by Markus Raabe over 6 years ago

Regarding WPaintedWidget I changed enableAjax to

void WPaintedWidget::enableAjax()

{

if (dynamic_cast<WWidgetCanvasPainter *>(painter_.get())

&& renderWidth_ != 0 && renderHeight_ != 0) {

update();

}

else { // inserted reset to avoid PNG rendering

painter_.reset();

update();

}

WInteractWidget::enableAjax();

}

because WCartesianChart really looked bad as PNG and it was slow on updates

    (1-4/4)