Optix SDK: How can I modifiy a simple example, re-compile and run?

I am new to OptiX and I have the OptiX SDK installed and running. I would like to get the normal shader code in the tutorial at level 0 to run. I am specifically interested in producing the same “pink-green” shaded box, then altering the colors and recompiling the code run. So far I have not had much luck with the INSTALL-LINUX.txt and the CMakeLists.txt documentation in creating a working directory. Seeing the pre-compiled samples working are great to watch but, I would like to get a separate simple example running! Any help is greatly appreciated!

You need to write a bit more detailed where you problem is located?
Are the example programs not compiling, does you CMake generate valid Makefiles, …

(1) The following $ make command does not generate the .cpp and .cu files in the new SDK rebuild directory. Only the executable files are compiled.

(2) Copying the contents of the SDK to another directory: When you modify the .cpp or .cu files the changes are not reflected in the re-compiled executable file.

Thanks SStypeR5,
regarding point (2): are you sure you’re modifying the CMake (CMakefiles) paths to your sources?

OptiX samples usually work like this: when you trigger a rebuild command (make), CMake is invoked targeting CMakefiles residing in their source directory. These in order invoke nvcc and the rest of the dependencies to compile CUDA C into ptx files that are then used by OptiX.

I don’t fully understand what does point 1 mean, can you expand a little more on that please?

For my issue with (2)
-I will check that out…

For my issue with (1)
-In the INSTALL-LINUX.txt document, there are eight to nine steps for compiling the samples in the SDK, upon the 8th step: Run ‘make’; then at step 9: ‘Executables should be found in the bin directory’ I did not find the executable files in the bin for my personal SDK directory. Specifically, I am working from the CMakeLists.txt and INSTALL-LINUX.txt documents trying to create/re-create my own project and use the SDK as a template.

CMake works like this:

C/C++ source files can be portable across many platforms, project solutions are not. This means that if you want to compile those sources in a Windows’ Visual Studio Solution or with a Linux’s Makefile, you have to generate different solution projects by yourself. Instead of including multiple solutions in the same package (that would make things really messy) OptiX uses CMake: when you generate a solution with CMake, you’re actually generating a solution for your platform (Linux, Windows or Mac OS X) which uses your source files to generate OptiX binaries.

So, for issue (1): if you ran CMake, configured it © and generated (g) a project solution (the makefiles you need in the directory you specified in step 1), you now need to cd to that directory and digit “make”. Check for errors in your compilation process. IF and ONLY IF your compilation process is free of errors, you will get your executables in the bin directory of your specified path (the same you specified at point 1).

If you have errors in the compilation process, ask here, you’re more than welcome.

Thank you marknv,

For Issue (1), I can currently generate my excutables in the \bin of my SDK build flavor. When I do the following command make[/i] in my SDK directory it generates about <50% of the excutable files. Some of the errors are due to not finding [i]helpers.h: No such file or directory[/i]. However, in the OptiX "sample1" directory I wanted to modify the color of the output from the greenish color to red (just as a sanity check). Initially I deleted the sample1 excutable file, altered the sample1.c file code to read at Line 103: RT_CHECK_ERROR( rtVariableSet3f( draw_color, 1.0f, 0.0f, 0.0f ) ); then saved the file and ran [i] make sample1 inside the directory. Yet, the color stays a greenish color despite my efforts to alter the values and repeated ‘make’ commands. Sorry for the hassle, I am just trying to see some simple results.

Changing that line in the way you did should indeed render the color red. A quick thing that comes to my mind is: is the CMAKE_BUILD_TYPE set accordingly to the executable you’re running? I mean: is it possible that you’re picking the wrong binary (like a release one) if you’re compiling it in another one (like debug mode) ? Or wrong path, too

As a sidenote: there are going to be big changes in the next releases of OptiX.

Some of them also related to how to generate OptiX projects from SDK samples. And some bugfixes, too ;)