Skip to content

Commit

Permalink
Added IECoreGL::Selector::IDSelect fallback for GLSL < 330.
Browse files Browse the repository at this point in the history
  • Loading branch information
johnhaddon committed Oct 23, 2013
1 parent bff8993 commit 3669dff
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 4 additions & 1 deletion include/IECoreGL/Selector.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ class Selector : boost::noncopyable
OcclusionQuery,
/// Renders each object to an offscreen framebuffer using a
/// unique colour per object. Can therefore only select the
/// frontmost objects, but does provide accurate depth information.
/// frontmost objects, but does provide accurate depth information.
/// Note that this mode is currently only supported for GLSL
/// versions 330 and up - lesser versions will fall back to using
/// the GLSelect mode.
IDRender
};

Expand Down
8 changes: 8 additions & 0 deletions src/IECoreGL/Selector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
#include "IECoreGL/Primitive.h"
#include "IECoreGL/ShaderLoader.h"
#include "IECoreGL/TextureLoader.h"
#include "IECoreGL/IECoreGL.h"

using namespace IECoreGL;

Expand Down Expand Up @@ -100,6 +101,13 @@ class Selector::Implementation : public IECore::RefCounted
glMultMatrixd( projectionMatrix );
glMatrixMode( GL_MODELVIEW );

// fall back to GLSelect mode if we can't
// support IDRender mode.
if( m_mode == IDRender && glslVersion() < 330 )
{
m_mode = GLSelect;
}

switch( m_mode )
{
case GLSelect :
Expand Down

0 comments on commit 3669dff

Please sign in to comment.