fixed gl picking

This commit is contained in:
Luigi Malomo 2021-06-11 16:40:48 +02:00
parent 85d6665430
commit 7d5d2271e6
1 changed files with 7 additions and 7 deletions

View File

@ -26,7 +26,8 @@
#include <vector> #include <vector>
#include <algorithm> #include <algorithm>
#include "gl_type_name.h"
#include <vcg/complex/complex.h>
namespace vcg{ namespace vcg{
@ -218,11 +219,11 @@ public:
int screenW = (int)(vp[2]-vp[0]); int screenW = (int)(vp[2]-vp[0]);
int screenH = (int)(vp[3]-vp[1]); int screenH = (int)(vp[3]-vp[1]);
GL_TYPE_NM<Scalarm>::ScalarType *buffer = new GL_TYPE_NM<Scalarm>::ScalarType[screenW*screenH]; GLfloat *buffer = new GLfloat[screenW*screenH];
//I'm not sure glReadPixels can accept GL_DOUBLE tag //glReadPixels does NOT accept GL_DOUBLE
//GLenum err = glGetError(); //GLenum err = glGetError();
glReadPixels(vp[0],vp[1],vp[2],vp[3],GL_DEPTH_COMPONENT,GL_TYPE_NM<Scalarm>::SCALAR(),buffer); glReadPixels(vp[0],vp[1],vp[2],vp[3],GL_DEPTH_COMPONENT,GL_FLOAT,buffer);
//err = glGetError(); //err = glGetError();
std::vector<FacePointer> result; std::vector<FacePointer> result;
PickFace(x,y,m,result,width,height); PickFace(x,y,m,result,width,height);
@ -261,11 +262,10 @@ public:
int screenH = vp[3]-vp[1]; int screenH = vp[3]-vp[1];
GL_TYPE_NM<Scalarm>::ScalarType *buffer = new GL_TYPE_NM<Scalarm>::ScalarType[screenW*screenH]; GLfloat *buffer = new GLfloat[screenW*screenH];
//I'm not sure glReadPixels can accept GL_DOUBLE tag
//GLenum err = glGetError(); //GLenum err = glGetError();
glReadPixels(vp[0],vp[1],vp[2],vp[3],GL_DEPTH_COMPONENT,GL_TYPE_NM<Scalarm>::SCALAR(),buffer); glReadPixels(vp[0],vp[1],vp[2],vp[3],GL_DEPTH_COMPONENT,GL_FLOAT,buffer);
//err = glGetError(); //err = glGetError();
std::vector<FacePointer> result; std::vector<FacePointer> result;