I have very basic question regarding the right way to declare variables form using Host API. For the sake of enquiry lets look into the optixHello sample distributed with Optix5.1 version. This sample is very simple in that it doesn’t really do any raytracing. It uses a program to define the ray_generation_program (draw_color.cu). In this CUDA file I see three variables 1)result_buffer 2)draw_color 3)launch_index. As
launch_index is predefined there is to problem understanding it and there is not need to declare it’s value from Host side.
`result_buffer` is a buffer in which the output of the whole simulation is stored, in optixHello.cpp it is declared using rtContextDeclareVariable(). Where as `draw_color` is declared using rtProgramDeclareVariable(). So my confusion is when is appropriate to use which function? How does all this figure out when I am using C++ wrapper. Like if have do the equivalent of rtProgramDeclareVariable() do I to query the variable from the program handle, some this like this?
The programming guide doesn’t really mention when to use which declaration function.