- disable color picking by default, and add error codes for selection buffer

This commit is contained in:
Mark Vejvoda 2011-12-14 01:15:27 +00:00
parent 2fd89f11d5
commit d64bf0a4c9
2 changed files with 21 additions and 4 deletions

View File

@ -5776,7 +5776,7 @@ void Renderer::computeSelected( Selection::UnitContainer &units, const Object *&
h = 1;
}
const bool newPickingSelection = Config::getInstance().getBool("EnableColorPicking","true");
const bool newPickingSelection = Config::getInstance().getBool("EnableColorPicking","false");
if(newPickingSelection == true) {
int x1 = posDown.x;
int y1 = posDown.y;
@ -5970,9 +5970,18 @@ void Renderer::computeSelected( Selection::UnitContainer &units, const Object *&
glSelectBuffer(Gui::maxSelBuff, selectBuffer);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
GLint view[]= {0, 0, metrics.getVirtualW(), metrics.getVirtualH()};
glRenderMode(GL_SELECT);
GLint renderModeResult = glRenderMode(GL_SELECT);
if(renderModeResult < 0) {
const char *errorString= reinterpret_cast<const char*>(gluErrorString(renderModeResult));
char szBuf[4096]="";
sprintf(szBuf,"OpenGL error #%d [0x%X] : [%s] at file: [%s], line: %d",renderModeResult,renderModeResult,errorString,__FILE__,__LINE__);
printf("%s\n",szBuf);
}
glLoadIdentity();
GLint view[]= {0, 0, metrics.getVirtualW(), metrics.getVirtualH()};
gluPickMatrix(x, y, w, h, view);
gluPerspective(perspFov, metrics.getAspectRatio(), perspNearPlane, perspFarPlane);
loadGameCameraMatrix();
@ -6014,6 +6023,14 @@ void Renderer::computeSelected( Selection::UnitContainer &units, const Object *&
}
}
}
else if(selCount < 0) {
const char *errorString= reinterpret_cast<const char*>(gluErrorString(selCount));
char szBuf[4096]="";
sprintf(szBuf,"OpenGL error #%d [0x%X] : [%s] at file: [%s], line: %d",selCount,selCount,errorString,__FILE__,__LINE__);
printf("%s\n",szBuf);
}
}
}

View File

@ -1195,7 +1195,7 @@ vector<int> BaseColorPickEntity::getPickedList(int x,int y,int w,int h, const ve
//printf("In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
static Chrono lastSnapshot(true);
const int selectionMillisecondUpdate = 350;
const int selectionMillisecondUpdate = 100;
if(PixelBufferWrapper::getIsPBOEnable() == true) {
// Only update the pixel buffer every x milliseconds or as required