Jump to content

codingJoe

Member Since 22 Oct 2012
Offline Last Active Feb 07 2017 02:21 AM

#5329117 Used three.js inside of Qt application

Posted by codingJoe on 24 January 2017 - 05:23 AM

Hello,

 

I have a portable C++ Qt application that does some openGl rendering in a main window. The rendering is currently still plain old OpenGL (not even with shaders), and I feel I need to move one level up by using a third-party library.

 

I was first thinking about Ogre, but this is heavy, and will need to be updated on a regular basis.

Then I discovered three.js and I am very pleased by the simplicity of everything. The only drawback for me is that it is javascript, but I can handle this.

 

My question is following:

 

I imagine using a webbrowser Qt widget as my main window content, so that I can do the display in there via three.js and javascript. The javascript code will read the render data from my C++ application. Is this feasable? And if yes, what kind of interface will I have to use between my C++ code and the javascript code, for fast data transfer and update?

 

Thanks




#5147017 My sockets are as fast as pipes..

Posted by codingJoe on 14 April 2014 - 05:23 PM

Thanks for the insightful comments!

So if I understood correctly, using shared memory is the solution. But still no guarantee for a speed increase.

I'll try my hands on this, thanks again




#5146956 My sockets are as fast as pipes..

Posted by codingJoe on 14 April 2014 - 12:47 PM

Hello,

 

For an IPC I used sockets for a long time. That's convenient and relatively fast.

Then I thought, at least when the 2 processes are on the same machine, that I could gain speed by using pipes instead. My idea of pipes was that they were using shared memory. But it turns out that my pipe communication is as slow as my socket communication. How can that be? Am I doing something wrong?

 

Currently, I have implemented the pipes on Windows, but if I can obtain a speed increase, I also want to do this on Linux.

 

Here my pipe implementation, client side:

// connect to an existing pipe:
HANDLE pipe=CreateFile("\\\\.\\Pipe\\myPipe",GENERIC_READ|GENERIC_WRITE,0,0,OPEN_EXISTING,0,0);

// Write something:
DWORD bytesWritten;
WriteFile(pipe,buffer,bufferSize,&bytesWritten,0)

// Read something:
DWORD bytesRead;
ReadFile(pipe,buffer,bufferSize,&bytesRead,0)

And here my pipe implementation, server side:

// Create the pipe:
HANDLE pipe=CreateNamedPipe("\\\\.\\Pipe\\myPipe",PIPE_ACCESS_DUPLEX,PIPE_TYPE_BYTE|PIPE_READMODE_BYTE|PIPE_WAIT,PIPE_UNLIMITED_INSTANCES,3000000,3000000,NMPWAIT_USE_DEFAULT_WAIT,NULL);

// Connect to client:
if (_pipe!=INVALID_HANDLE_VALUE)
    ConnectNamedPipe(_pipe,NULL);

// Read and write from client is implemented in the same was as for the client read/write routines

Anything I am doing wrong?