Project

General

Profile

Actions

Support #6960

closed

WGLWidget - Use of binary buffer and a signal or some sort of indicator to check buffers are loaded

Added by Prasad Dixit about 5 years ago. Updated over 4 years ago.

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

0%

Estimated time:

Description

I am using WGLWidget to load 3D models which can be of large size. In order to speed it up, I use binary buffer option to transfer vertex buffers. Documentations tates this about using binary buffers:

Binary buffer transfers

_

In bufferDatafv(), there is an additional boolean argument where you can indicate that you want the data to be transferred to the client in binary form. A WMemoryResource is created for each of these buffers. If you know all previous resources are not required in the client anymore, you can free memory with the method clearBinaryResources() (the memory is also managed, so this is not neccesary). If you want to manage these resources entirely by yourself, the following method can be used.

Using createAndLoadArrayBuffer(), you can load an array buffer in binary format from an URL. This will cause the client to fetch the given URL, and make the contents of the file available in an ArrayBuffer, which can then be used by BufferData() to bind them to an OpenGL buffer. This is ideal to load VBO buffers in a faster way, as it avoids converting floats to text strings on the server and then back to floats on the client. You can combine this with the use of WResource (e.g. WMemoryResource) to send an std::vector of vertices to the client. Note that using ArrayBuffer is not possible when you want a fall-back in the form of server-side rendering.

Everything works as expected except one thing - I set the status message as 'Ready' when the file is loaded and buffer data is updated on server side. But there is a delay between the time buffer data is set on server and the time it is sent to client and updated on client side.

_

Please see the video and notice the delay between status is set to "Ready" at the bottom and the time when model is rendered - Video

My understanding is that when binary buffer is used, data is transferred as a memory resource - one per vertex buffer (vertices, normals, texture coordinates etc) . I think a signal which is emitted when all binary buffer data is available on client side will be very useful to indicate that the model is "actually" ready so that status message can be updated at the most apt time.

Or may be there is some other mechanism to handle it?

I would appreciate some input on how to handle this.

The delay increases significantly on a hosted website instead of localhost.


Files

paintedSignal.patch (1.61 KB) paintedSignal.patch Roel Standaert, 05/27/2019 10:21 AM
Actions #1

Updated by Prasad Dixit about 5 years ago

A video with a larger file demonstrates the problem better: Video

Actions #2

Updated by Wim Dumon about 5 years ago

Hi,

I don't think this is possible now.

A JSignal would need to be added that is triggered from WGLWidget.js, in handlePreload. This would allow to inform the server side that the first paint has effectively been executed.

Best regards,

Wim.

Actions #3

Updated by Prasad Dixit about 5 years ago

Thank you very much for clarification, Wim!

I love the idea behind Wt and using it in a niche use case. Thank you for developing this wonderful toolkit. I am placing my bets on Wt to develop a 3D visualization engine involving rendering of large 3D data-sets instead of using more common three.js.

A functionality to indicate that the binary buffers are loading (some sort of progress indicator) and an indicator that the binary buffers are processed is going to be very critical for good user experience.

Is Wt's team going to make it a priority for future releases?

Thank you!

Cheers,

-Prasad

Actions #4

Updated by Prasad Dixit almost 5 years ago

Can someone point me to how I can accomplish this now before Wt's team work on it?

Is there anyway this can be accomplished by insertJavaScript/JSSignal/doJavaScript or override current implementation of handlePreload of WGLWidget.js somehow?

Thank you for your help!

Actions #5

Updated by Roel Standaert almost 5 years ago

I found there is a function called injectJS that you can use to do what you want (I forgot about its existence myself). I attached a patch for the webgl example demonstrating its use to notify the server on the first paint.

Actions #6

Updated by Roel Standaert almost 5 years ago

I think that considering the fact that it can be done with injectJS, we don't really need to add a dedicated JSignal for this anymore?

Actions #7

Updated by Roel Standaert over 4 years ago

  • Status changed from New to Closed

I'm closing this due to inactivity, I hope that the injectJS did what you wanted.

Actions

Also available in: Atom PDF