Optix 5 denoiser example?

Is there an example on how to run the new denoiser, e.g. on a GL texture or CUDA array that I already have?

Ok, found it in the installed Optix 5 SDK:

OptiX SDK 5.0.0\SDK\optixDenoiser

Copying from/to OpenGL can be done using PBOs:

// use PBO to copy from inputTexId to inputBuffer
const unsigned inputPBO = _inputBuffer->getGLBOId();
glBindTexture(GL_TEXTURE_2D, inputTexId);
glBindBuffer(GL_PIXEL_PACK_BUFFER, inputPBO);
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_FLOAT, 0);
glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
glBindTexture(GL_TEXTURE_2D, 0);


glBindTexture(GL_TEXTURE_2D, inputTexId);

// use PBO to copy back to inputTexId
const unsigned outputPBO = _denoisedBuffer->getGLBOId();
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, outputPBO);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h, GL_RGBA, GL_FLOAT, imageData);
glBindTexture(GL_TEXTURE_2D, 0);