View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# Map coord selection in 3d

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

No replies to this topic

### #1Kudaba  Members

Posted 19 June 2001 - 06:30 AM

I''m trying to easily use OpenGL selection buffer to pick out points on a map. I''m not sure how easy this is as I''ve never made selection to work but basically I found a little page that said what I was doing should work, here''s the code: glSelectBuffer(128, buffer); /* initialize */ glRenderMode(GL_SELECT); glInitNames(); glPushName(-1); glGetIntegerv(GL_VIEWPORT,viewport); /* set up pick view */ glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); gluPickMatrix(Ms[X_],viewport[3] - Ms[Y_], 2, 2,viewport); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glRotatef(rt[Y_], 0.0f, 1.0f, 0.0f); GlRotatef(rt[X_], 1.0f, 0.0f, 0.0f); glRotatef(rt[Z_], 0.0f, 0.0f, 1.0f); glTranslatef(-loc[X_], -loc[Y_] - 2.0f, -loc[Z_]); glBegin(GL_POINTS); for (int y = 0; y < MAXMAPSIZE - 1; y++) { glPushName(y + 1); for (int x = 0; x < MAXMAPSIZE - 1; x++) { glPushName(x + 1); glLoadName(1); // not 100% sure about this one glVertex3fv(Points[x][y]); glPopName(); } glPopName(); } glEnd(); glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); hits = glRenderMode(GL_RENDER); Hits is always 0. If anyone, can help me, is there some huge important step that I''m missing and no one ever explains or something.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.