diff --git a/src/IECoreGL/Selector.cpp b/src/IECoreGL/Selector.cpp index 38555febf1..53dd5d063a 100644 --- a/src/IECoreGL/Selector.cpp +++ b/src/IECoreGL/Selector.cpp @@ -443,10 +443,10 @@ class Selector::Implementation : public IECore::RefCounted std::vector buffers; buffers.resize( std::max( fragDataLocation, depthDataLocation ) + 1, GL_NONE ); - buffers[buffers.size() - ( depthDataLocation > 0 ? 2 : 1 )] = GL_COLOR_ATTACHMENT0; + buffers[fragDataLocation] = GL_COLOR_ATTACHMENT0; if( m_useCameraDepth ) { - buffers[buffers.size() - 1] = GL_COLOR_ATTACHMENT1; + buffers[depthDataLocation] = GL_COLOR_ATTACHMENT1; } glDrawBuffers( buffers.size(), &buffers[0] );