- attempt to see if this fixes tomreyn's selectbuf problems

This commit is contained in:
Mark Vejvoda
2012-11-15 07:28:48 +00:00
parent 20def412bf
commit 11fdaf899b

View File

@@ -6786,8 +6786,8 @@ void Renderer::selectUsingSelectionBuffer(Selection::UnitContainer &units,
//setup matrices //setup matrices
glSelectBuffer(Gui::maxSelBuff, selectBuffer); glSelectBuffer(Gui::maxSelBuff, selectBuffer);
glMatrixMode(GL_PROJECTION); //glMatrixMode(GL_PROJECTION);
glPushMatrix(); //glPushMatrix();
GLint renderModeResult = glRenderMode(GL_SELECT); GLint renderModeResult = glRenderMode(GL_SELECT);
if(renderModeResult < 0) { if(renderModeResult < 0) {
@@ -6797,12 +6797,21 @@ void Renderer::selectUsingSelectionBuffer(Selection::UnitContainer &units,
printf("%s\n",szBuf); printf("%s\n",szBuf);
} }
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity(); glLoadIdentity();
const Metrics &metrics= Metrics::getInstance(); const Metrics &metrics= Metrics::getInstance();
GLint view[]= {0, 0, metrics.getVirtualW(), metrics.getVirtualH()}; GLint view[]= {0, 0, metrics.getVirtualW(), metrics.getVirtualH()};
//GLint view[4];
//glGetIntegerv(GL_VIEWPORT, view);
gluPickMatrix(x, y, w, h, view); gluPickMatrix(x, y, w, h, view);
gluPerspective(perspFov, metrics.getAspectRatio(), perspNearPlane, perspFarPlane); //gluPerspective(perspFov, metrics.getAspectRatio(), perspNearPlane, perspFarPlane);
gluPerspective(perspFov, metrics.getAspectRatio(), 0.0001, 1000.0);
//gluPerspective(perspFov, (float)view[2]/(float)view[3], perspNearPlane, perspFarPlane);
loadGameCameraMatrix(); loadGameCameraMatrix();
//render units to find which ones should be selected //render units to find which ones should be selected
@@ -6817,7 +6826,7 @@ void Renderer::selectUsingSelectionBuffer(Selection::UnitContainer &units,
// Added this to ensure all the selection calls are done now // Added this to ensure all the selection calls are done now
// (see http://www.unknownroad.com/rtfm/graphics/glselection.html section: [0x4]) // (see http://www.unknownroad.com/rtfm/graphics/glselection.html section: [0x4])
glFlush(); //glFlush();
//select units by checking the selected buffer //select units by checking the selected buffer
int selCount= glRenderMode(GL_RENDER); int selCount= glRenderMode(GL_RENDER);