Page 472 OpenGL Super Bible! count, /* Selection (Space web hosting)
Page 472 OpenGL Super Bible! count, /* Selection count */ x, y; /* Terrain (x,y) location */ GLfloat *height; /* Current height */ GLuint buffer[100]; /* Selection buffer */ GLint viewport[4]; /* OpenGL viewport */ /* * Get the current OpenGL viewport and make the vertical * mouse position start from the bottom of the viewport. */ glGetIntegerv(GL_VIEWPORT, viewport); mousey = viewport[3] - 1 - mousey; /* * Begin selection into a 100 ‘hit buffer * * Allow picks within 4 pixels of the current mouse position. */ glSelectBuffer(100, buffer); glRenderMode(GL_SELECT); glInitNames(); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPickMatrix((GLdouble)mousex, (GLdouble)mousey, 4.0, 4.0, viewport); gluPerspective(45.0, (float)viewport[2] / (float)viewport[3], 0.1, 1000.0); glMatrixMode(GL_MODELVIEW); glPushMatrix(); /* * Rotate/translate for the current viewing position and * orientation. */ glRotatef(Roll, 0.0, 0.0, 1.0); glRotatef(Pitch, -1.0, 0.0, 0.0); glRotatef(Heading, 0.0, 1.0, 0.0); glTranslatef(-Position[0], -Position[1], -Position[2]); glScalef(TERRAIN_SCALE, TERRAIN_SCALE, TERRAIN_SCALE); /* * Draw the terrain into the selection buffer. This is * done differently than the RepaintWindow() function does * so that we can select individual cells rather than whole * strips of one type. * * The select buffer has names pushed on the stack for both * the X and Y locations in the terrain */
We would like to recommend you tested and proved virtual web hosting services, which you will surely find to be of great quality.