Commit 7f87db57 authored by Jan Möbius's avatar Jan Möbius
Browse files

Added checks for picking if no edges or faces are avaiable ( otherwise...

Added checks for picking if no edges or faces are avaiable ( otherwise segfault due to 0 pointer access )

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@9182 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 9fd89f46
......@@ -1117,21 +1117,25 @@ pick_any(GLState& _state)
anyPickingBaseIndex_ = _state.pick_current_index ();
}
if (_state.color_picking ()) {
if (_state.color_picking() ) {
stripProcessor_.updatePickingAny(_state);
// For this version we load the colors directly not from vbo
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glVertexPointer( stripProcessor_.perFaceVertexBuffer() );
glColorPointer( stripProcessor_.pickFaceColorBuffer() );
glDrawArrays(GL_TRIANGLES, 0, stripProcessor_.perFaceVertexBufferSize() );
// If we do not have any faces, we generate an empty list here.
if ( mesh_.n_faces() != 0) {
glVertexPointer( stripProcessor_.perFaceVertexBuffer() );
glColorPointer( stripProcessor_.pickFaceColorBuffer() );
glDrawArrays(GL_TRIANGLES, 0, stripProcessor_.perFaceVertexBufferSize() );
}
if (anyPickingList_)
{
......@@ -1141,10 +1145,14 @@ pick_any(GLState& _state)
glDepthFunc(GL_LEQUAL);
glVertexPointer (stripProcessor_.perEdgeVertexBuffer());
glColorPointer(stripProcessor_.pickEdgeColorBuffer());
// If we do not have any edges, we generate an empty list here.
if ( mesh_.n_edges() != 0) {
glVertexPointer (stripProcessor_.perEdgeVertexBuffer());
glColorPointer(stripProcessor_.pickEdgeColorBuffer());
glDrawArrays(GL_LINES, 0, mesh_.n_edges() * 2);
glDrawArrays(GL_LINES, 0, mesh_.n_edges() * 2);
}
if (anyPickingList_)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment