Update 2018-03-06:
It works! Check out the repo for the most up-to-date information.
This visual studio project compiles and creates a dll, but the dll fails to load in TouchDesigner (follow the README instructions). For reference I’m looking at this example github.com/IntelRealSense/libre … es/capture
Here’s an overview of the modifications from the OpenGLTOP in C:\Program Files\Derivative\TouchDesigner099\Samples\CPlusPlus\OpenGLTOP
OpenGLTOP.h
bool hasStarted = false; // declare a private variable
OpenGLTOP.cpp
// at the very top of the file
#include <librealsense2/rs.hpp> // Include RealSense Cross Platform API
rs2::pipeline pipe;
[code]// inside the execute function
if (!hasStarted) {
hasStarted = true;
pipe.start();
}[/code]
Later, the missing pieces would involve
rs2::frameset data = pipe.wait_for_frames();
data.get_depth_frame();
// and rendering into the context
Teach a man to fish so that I can do this for the 100 other “Kinect replacements” coming out
If it’s failing to load the .dll it’s likely because there are other .dlls it depends on that it can’t find. You can use the Dependency Walker took you can download from microsoft to help determine what .dll it needs. They should usually be placed in the same directory as your .dll.
Thanks for the tip. Things got better once I pasted the dlls. Now I’m stuck because the inner section never gets executed.
rs2::frameset frames;
if (pipe.poll_for_frames(&frames)) {
// get the data and render into TD...
}
There’s an alternative way of getting the data with
rs2::frameset data = pipe.wait_for_frames();
but that errors out with RS2_EXCEPTION_TYPE_DEVICE_IN_RECOVERY_MODE. That error doesn’t make sense to me because I think the firmware is the latest (05.08.15.00)
I know realsense will be supported in a future build of TD. I’m just trying to get familiar with the realsense library and c++ so that I can combine it with a skeleton tracking API soon.
I just finished my work on this, next posted 2018.20000 series will have it. I’m not sure about that error, sorry. I didn’t run into anything like that.
This C++ version works well with one or two cameras, but I have 8 cameras going into a PC via fast USB controllers, and in that situation some of the C++ RealSense TOPS cook at 4ms/frame. Even with 8 cameras, the built-in RealSense TOP isn’t slow like this, but it has the IR emitter always enabled. So, I’m hoping someone might have a tip on speeding up this C++ version.
The main reason the TOP is faster than your .dll is because the TOP does all of it’s image capturing and even memcpy operations in another thread. The main reason outputFormat->cpuPixelData has multiple buffers available to you is because this gives you the ability to update one or more buffers in another thread, and have the main thread that calls execute() just hand off already filled buffer to be output.