FIXED: CPlusPlus TOP and >1 color buffer

Hi,

I’m trying to draw to more than one color buffer in the CPlusPlus TOP using the OpenGLTOP example and am getting stuck. The many references to color buffers/Renderbuffers in the source files lead me to think this is supported, but I’m obviously missing something.

In the TOP_Context declaration, it says:

If I set the CPlusPlus TOP to have >1 color buffers (before loading the .dll) and print some relevant information to the console:

context->beginGLCommands(); setupGL(); printf("num buffers: %u\n", outputFormat->numColorBuffers); printf("Renderbuffer id0: %u\n", outputFormat->colorBufferRB[0]); printf("Renderbuffer id1: %u\n", outputFormat->colorBufferRB[1]); printf("Frambuffer id: %u\n", context->getFBOIndex());

it doesn’t indicate that more buffers exist:

The default scene doesn’t render with >1 color buffer, I assume due to TOP_OutputFormatSpecs::colorBuffer0Type changing from GL_TEXTURE_2D to GL_RENDERBUFFER.

This gives me hope, but only one buffer exists. How do I make more that work with glDrawBuffersARB()?

Sorry for the long post, any help is greatly appreciated. Thank you!

I broke this when I added the CUDA feature to the CPlusPlus TOP. :confused:

This will be fixed in build 2017.2580 or later, thanks for the report. Moving this to the bugs forum.

Oh ok, in 099? I was just going to reply it’s working fine for me in 088.

Cheers,
Vincent

Ya this is a 099 bug

Oh great, glad to hear it! Thank you!

Is this working for CUDA in the last experimental build (2019.36502) ? I’m getting numColorbuffers = 0 and only cudaOutputs[0] is allocated regardless the number of color buffers I select.

Currently numColorBuffers is only used for the OpenGL mode. I won’t allocate more buffers for CUDA.

@malcolm this is still true right, only one buffer for cuda mode?

In TOP_CPlusPlusBase.h seeing
// Only used when executeMode == TOP_ExecuteMode::OpenGL_FBO
for numColorBuffers

Though this comment feels there could be multiple output buffers for cuda :
// Write to this CUDA memory to fill the output textures
cudaArray* const cudaOutput[32];

Thank you!

Just hit this issue myself when working in CUDA. Even if numColorBuffers is increased, and the ‘# of color buffers’ parameters set to 2, nothing other than cudaOuput[0] appears to be instantiated.