Original Post
I have been trying to use OpenGL picking with no luck. Below is the code that I use to try to make it work. If anyone would be so kind as to let me know the error, I would be very grateful.
(pModel and pModel1 are MilkShape model objects)
void Draw (void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity();
ProcessKeys();
camera.Update();
gluLookAt(camx, camy+3, camz+5,
0, 0, 0,
0, 1, 0);
glRotatef( -camYaw + cx, 0.0, 1.0, 0.0 );
glTranslatef( -xpos, -ypos, -zpos );
glInitNames();
glPushName(0);
terrain.Render(5.0f, 5.0f);
glLoadName(100);
pModel1->draw(xpos, terrain.GetHeight(xpos, zpos), zpos, camYaw);
glLoadName(101);
pModel->draw(xpos, terrain.GetHeight(xpos, zpos), zpos, camYaw);
glColor4f(1.0, 1.0, 1.0, 1.0);
glDrawText(40, 0 + FONT_HEIGHT, "FPS: %d", gfps);
drawcursor(mousex, mousey);
getfps();
}