Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash on picking #5

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ include_directories(
# ライブラリパスの指定
if(BUILD_ENV_MSVC)
set(GLUT_LIB ${SDKROOT}/glut/3.7.6/lib/glut64.lib)
set(GL_LIB opengl32.lib)
set(GL_LIB opengl32.lib glu32.lib)
elseif(BUILD_ENV_APPLE)
find_library(GLUT_LIB GLUT)
find_library(GL_LIB OpenGL)
Expand Down
11 changes: 11 additions & 0 deletions sources/sceneviewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
#include <QPointF>
#include <QVector3D>

#ifdef _WIN32
#include <GL/GLU.h>
#endif
#ifdef MACOSX
#include <GLUT/glut.h>
#endif
Expand Down Expand Up @@ -1384,8 +1387,14 @@ QList<int> SceneViewer::pickAll(const QPoint& pos) {
glPushMatrix();
glLoadIdentity();
// �s�b�N�̈�̎w��B���͈̔͂ɕ`��𐧌�����
#ifdef _WIN32
gluPickMatrix(pos.x(), height() - pos.y(), pickRange, pickRange, viewport);
#endif
#ifdef MACOSX
my_gluPickMatrix(pos.x(), height() - pos.y(), pickRange, pickRange,
viewport);
#endif

glMultMatrixd(mat);

glMatrixMode(GL_MODELVIEW);
Expand All @@ -1409,6 +1418,8 @@ QList<int> SceneViewer::pickAll(const QPoint& pos) {
bool pointPicked = false;
for (int i = 0; i < hitCount; ++i) {
GLuint nameCount = *p++;
GLuint zmin = *p++;
GLuint zmax = *p++;
if (nameCount > 0) {
GLuint name = *p;
if (name % 10000 > 0) pointPicked = true;
Expand Down