RT_ERROR_INVALID_VALUE

I am working with Optix 3.0 and CUDA 4.2 on NVIDIA GeForce GTX 680.

When I try to create a buffer object using createBufferFromGLBO (which in turn uses rtBufferCreateFromGLBO), it throws an error and the result code is RT_ERROR_INVALID_VALUE. Could someone please guide me how to go about debugging this and what does this value mean?

PS: I am new to programming in OptiX, so any pointers would be appreciated. Thanks!

Hi, I suggest you to look into the OptiX API Reference pdf manual when you have questions like this. Since, as you noted, createBufferFromGLBO uses rtBufferCreateFromGLBO, it internally requires 4 parameters

RTresult rtBufferCreateFromGLBO(RTcontext context, 
                                unsigned int bufferdesc, 
                                unsigned int gl_id, 
                                RTbuffer* buffer)

You need to make sure that

  • You have a valid context
  • You filled in a valid bufferdesc (combination of flags and types e.g. RT_BUFFER_INPUT)
  • You have a valid openGL buffer object (either vertex or pixel)

then you might call the function to properly return a pointer to the newly created OptiX buffer

Check if rtContextGetErrorString() returns more details about the reason for this error.

If it’s due to an OpenGL error OptiX checks for inside the OpenGL interoperability functions, make sure that your application did not leave an OpenGL error state active before calling into OpenGL interop functions. That is, check if calling glGetError() inside your application returns an error before you’re doing that buffer creation.
If yes, you’d need to track down where that OpenGL error was generated in the first place and fix it.
If not, check if your OpenGL buffer object had a size != 0 before the call.
If that still doesn’t help, I’d recommend to walk through some OptiX examples using that call as well and compare the OpenGL calls around that to your code.