...
 
Commits (1)
......@@ -1216,25 +1216,28 @@ void VolumeMeshNodeT<VolumeMeshT>::pick(GLState& _state, PickTarget _target) {
lastPickTarget_ = _target;
// restore state
if (clientStateEnabledVertexArray)
GLState::enableClientState(GL_VERTEX_ARRAY);
else
GLState::disableClientState(GL_VERTEX_ARRAY);
if (clientStateEnabledColorArray)
GLState::enableClientState(GL_COLOR_ARRAY);
else
GLState::disableClientState(GL_COLOR_ARRAY);
if (clientStateEnabledNormalArray)
GLState::enableClientState(GL_NORMAL_ARRAY);
else
GLState::disableClientState(GL_NORMAL_ARRAY);
if (clientStateEnabledTexCoordArray)
GLState::enableClientState(GL_TEXTURE_COORD_ARRAY);
else
GLState::disableClientState(GL_TEXTURE_COORD_ARRAY);
if(_state.compatibilityProfile())
{
if (clientStateEnabledVertexArray)
GLState::enableClientState(GL_VERTEX_ARRAY);
else
GLState::disableClientState(GL_VERTEX_ARRAY);
if (clientStateEnabledColorArray)
GLState::enableClientState(GL_COLOR_ARRAY);
else
GLState::disableClientState(GL_COLOR_ARRAY);
if (clientStateEnabledNormalArray)
GLState::enableClientState(GL_NORMAL_ARRAY);
else
GLState::disableClientState(GL_NORMAL_ARRAY);
if (clientStateEnabledTexCoordArray)
GLState::enableClientState(GL_TEXTURE_COORD_ARRAY);
else
GLState::disableClientState(GL_TEXTURE_COORD_ARRAY);
}
}
......@@ -1278,15 +1281,17 @@ void VolumeMeshNodeT<VolumeMeshT>::pickVertices(GLState& _state) {
GLState::bindBuffer(GL_ARRAY_BUFFER, vertexPickBufferManager_.getPickBuffer(_state, 0));
GLState::enableClientState(GL_VERTEX_ARRAY);
GLState::vertexPointer(3, GL_FLOAT, vertexPickBufferManager_.getStride(), reinterpret_cast<GLvoid*>(0));
GLState::enableClientState(GL_COLOR_ARRAY);
GLState::colorPointer(4, GL_UNSIGNED_BYTE, vertexPickBufferManager_.getStride(), reinterpret_cast<GLvoid*>(vertexPickBufferManager_.getColorOffset()));
GLState::shadeModel(GL_SMOOTH);
GLState::disable(GL_LIGHTING);
if(_state.compatibilityProfile())
{
GLState::enableClientState(GL_VERTEX_ARRAY);
GLState::vertexPointer(3, GL_FLOAT, vertexPickBufferManager_.getStride(), reinterpret_cast<GLvoid*>(0));
GLState::enableClientState(GL_COLOR_ARRAY);
GLState::colorPointer(4, GL_UNSIGNED_BYTE, vertexPickBufferManager_.getStride(), reinterpret_cast<GLvoid*>(vertexPickBufferManager_.getColorOffset()));
GLState::shadeModel(GL_SMOOTH);
GLState::disable(GL_LIGHTING);
}
float oldPointSize = _state.point_size();
_state.set_point_size(1.5*_state.point_size());
......@@ -1294,8 +1299,11 @@ void VolumeMeshNodeT<VolumeMeshT>::pickVertices(GLState& _state) {
_state.set_point_size(oldPointSize);
GLState::disableClientState(GL_COLOR_ARRAY);
GLState::bindBuffer(GL_ARRAY_BUFFER, 0);
if(_state.compatibilityProfile())
{
GLState::disableClientState(GL_COLOR_ARRAY);
GLState::bindBuffer(GL_ARRAY_BUFFER, 0);
}
}
......@@ -1315,14 +1323,17 @@ void VolumeMeshNodeT<VolumeMeshT>::pickEdges(GLState& _state, unsigned int _offs
GLState::bindBuffer(GL_ARRAY_BUFFER, edgePickBufferManager_.getPickBuffer(_state, _offset));
GLState::enableClientState(GL_VERTEX_ARRAY);
GLState::vertexPointer(3, GL_FLOAT, edgePickBufferManager_.getStride(), reinterpret_cast<GLvoid*>(0));
GLState::enableClientState(GL_COLOR_ARRAY);
GLState::colorPointer(4, GL_UNSIGNED_BYTE, edgePickBufferManager_.getStride(), reinterpret_cast<GLvoid*>(edgePickBufferManager_.getColorOffset()));
GLState::shadeModel(GL_SMOOTH);
GLState::disable(GL_LIGHTING);
if(_state.compatibilityProfile())
{
GLState::enableClientState(GL_VERTEX_ARRAY);
GLState::vertexPointer(3, GL_FLOAT, edgePickBufferManager_.getStride(), reinterpret_cast<GLvoid*>(0));
GLState::enableClientState(GL_COLOR_ARRAY);
GLState::colorPointer(4, GL_UNSIGNED_BYTE, edgePickBufferManager_.getStride(), reinterpret_cast<GLvoid*>(edgePickBufferManager_.getColorOffset()));
GLState::shadeModel(GL_SMOOTH);
GLState::disable(GL_LIGHTING);
}
float oldLineWidth = _state.line_width();
_state.set_line_width(4.0*_state.line_width());
......@@ -1331,8 +1342,11 @@ void VolumeMeshNodeT<VolumeMeshT>::pickEdges(GLState& _state, unsigned int _offs
_state.set_line_width(oldLineWidth);
GLState::disableClientState(GL_COLOR_ARRAY);
GLState::bindBuffer(GL_ARRAY_BUFFER, 0);
if(_state.compatibilityProfile())
{
GLState::disableClientState(GL_COLOR_ARRAY);
GLState::bindBuffer(GL_ARRAY_BUFFER, 0);
}
}
......@@ -1354,19 +1368,24 @@ void VolumeMeshNodeT<VolumeMeshT>::pickFaces(GLState& _state, unsigned int _offs
GLState::bindBuffer(GL_ARRAY_BUFFER, facePickBufferManager_.getPickBuffer(_state, _offset));
GLState::enableClientState(GL_VERTEX_ARRAY);
GLState::vertexPointer(3, GL_FLOAT, facePickBufferManager_.getStride(), reinterpret_cast<GLvoid*>(0));
GLState::enableClientState(GL_COLOR_ARRAY);
GLState::colorPointer(4, GL_UNSIGNED_BYTE, facePickBufferManager_.getStride(), reinterpret_cast<GLvoid*>(facePickBufferManager_.getColorOffset()));
GLState::shadeModel(GL_SMOOTH);
GLState::disable(GL_LIGHTING);
if(_state.compatibilityProfile())
{
GLState::enableClientState(GL_VERTEX_ARRAY);
GLState::vertexPointer(3, GL_FLOAT, facePickBufferManager_.getStride(), reinterpret_cast<GLvoid*>(0));
GLState::enableClientState(GL_COLOR_ARRAY);
GLState::colorPointer(4, GL_UNSIGNED_BYTE, facePickBufferManager_.getStride(), reinterpret_cast<GLvoid*>(facePickBufferManager_.getColorOffset()));
GLState::shadeModel(GL_SMOOTH);
GLState::disable(GL_LIGHTING);
}
glDrawArrays(GL_TRIANGLES, 0, facePickBufferManager_.getNumOfVertices());
GLState::disableClientState(GL_COLOR_ARRAY);
GLState::bindBuffer(GL_ARRAY_BUFFER, 0);
if(_state.compatibilityProfile())
{
GLState::disableClientState(GL_COLOR_ARRAY);
GLState::bindBuffer(GL_ARRAY_BUFFER, 0);
}
}
//----------------------------------------------------------------------------
......@@ -1381,19 +1400,25 @@ void VolumeMeshNodeT<VolumeMeshT>::pickCells(GLState& _state, unsigned int _offs
GLState::bindBuffer(GL_ARRAY_BUFFER, cellPickBufferManager_.getPickBuffer(_state, _offset));
GLState::enableClientState(GL_VERTEX_ARRAY);
GLState::vertexPointer(3, GL_FLOAT, cellPickBufferManager_.getStride(), reinterpret_cast<GLvoid*>(0));
GLState::enableClientState(GL_COLOR_ARRAY);
GLState::colorPointer(4, GL_UNSIGNED_BYTE, cellPickBufferManager_.getStride(), reinterpret_cast<GLvoid*>(cellPickBufferManager_.getColorOffset()));
GLState::shadeModel(GL_SMOOTH);
GLState::disable(GL_LIGHTING);
if(_state.compatibilityProfile())
{
GLState::enableClientState(GL_VERTEX_ARRAY);
GLState::vertexPointer(3, GL_FLOAT, cellPickBufferManager_.getStride(), reinterpret_cast<GLvoid*>(0));
GLState::enableClientState(GL_COLOR_ARRAY);
GLState::colorPointer(4, GL_UNSIGNED_BYTE, cellPickBufferManager_.getStride(), reinterpret_cast<GLvoid*>(cellPickBufferManager_.getColorOffset()));
GLState::shadeModel(GL_SMOOTH);
GLState::disable(GL_LIGHTING);
}
glDrawArrays(GL_TRIANGLES, 0, cellPickBufferManager_.getNumOfVertices());
GLState::disableClientState(GL_COLOR_ARRAY);
GLState::bindBuffer(GL_ARRAY_BUFFER, 0);
if(_state.compatibilityProfile())
{
GLState::disableClientState(GL_COLOR_ARRAY);
GLState::bindBuffer(GL_ARRAY_BUFFER, 0);
}
}
//----------------------------------------------------------------------------
......