From d64bf0a4c9cc00763b147020818302747569e1cd Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Wed, 14 Dec 2011 01:15:27 +0000 Subject: [PATCH] - disable color picking by default, and add error codes for selection buffer --- source/glest_game/graphics/renderer.cpp | 23 +++++++++++++++++--- source/shared_lib/sources/graphics/model.cpp | 2 +- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/source/glest_game/graphics/renderer.cpp b/source/glest_game/graphics/renderer.cpp index 9403f4ba..93df4a36 100644 --- a/source/glest_game/graphics/renderer.cpp +++ b/source/glest_game/graphics/renderer.cpp @@ -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(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(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); + } + } } diff --git a/source/shared_lib/sources/graphics/model.cpp b/source/shared_lib/sources/graphics/model.cpp index 1749b6cd..abc0f63c 100644 --- a/source/shared_lib/sources/graphics/model.cpp +++ b/source/shared_lib/sources/graphics/model.cpp @@ -1195,7 +1195,7 @@ vector 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