This question is meant to help beginners of NVIDIA OptiX (much like myself)
What's Happening
When working with the OptiX compiled examples (delivered with the installation of OptiX), I am trying to print to the console from one of the computer kernels and I keep getting these errors:
error: cannot convert ‘optix::Context {aka optix::Handle<optix::ContextObj>}’ to ‘RTcontext’ for argument ‘1’ to ‘RTresult rtContextSetPrintEnabled(RTcontext, int)’
error: cannot convert ‘optix::Context {aka optix::Handle<optix::ContextObj>}’ to ‘RTcontext’ for argument ‘1’ to ‘RTresult rtContextSetPrintBufferSize(RTcontext, RTsize)’
Attempted Solution
Inside the createContext()
function, under where the context is created, I added lines of code to turn on debug printing. The lines of code I added are:
rtContextSetPrintEnabled(context, 1);
rtContextSetPrintBufferSize(context, 4096);
These are the two lines that produce the above error. I added these lines of code after the instantiation of the context object, provided by the code below - from the original nvidia example:
context = Context::create();
context->setRayTypeCount( 2 );
context->setEntryPointCount( 1 );
context->setStackSize( 2800 );
So, complete code that breaks looks like this:
// Set up context
context = Context::create();
context->setRayTypeCount( 2 );
context->setEntryPointCount( 1 );
context->setStackSize( 2800 );
// Setup debug printing
rtContextSetPrintEnabled(context, 1);
rtContextSetPrintBufferSize(context, 4096);
Some background information
I am trying to modify the optixWhitted project, working on a CentOS computer using the NSight edition of Eclipse.
Question
While using the optixWhitted code, and trying to maintain the code style and object usage already laid out... How do I solve this?