   Picking 2d and 3d objects!
  Hi there!im currently working on picking objects in 2d and 3d mode!all objects that are passed to the renderer goes here before getting rendered!the trick im attempting to do is to switch in Ortho mode when a primitive has an ortho flag... for some reason, whenever i try to pick a 3d primitive it always return the ortho primitive, even if the picking occurs outside the ortho primitive (UI element)... heres the code:void OpenGL::SetPicking(Actor *in_actor, Primitive *in_primitive, Int in_x, Int in_y){Int l_precision = 4;GLint l_viewport[4];GLuint l_buffer[512];glGetIntegerv(GL_VIEWPORT, l_viewport);glSelectBuffer(512, l_buffer);glMatrixMode(GL_PROJECTION);glPushMatrix();glLoadIdentity();glRenderMode(GL_SELECT);gluPickMatrix(in_x, m_height - in_y, l_precision, l_precision, l_viewport);if (in_primitive->IsOrtho())glOrtho(0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f); // Left, Right, Bottom, Top, zNear, zFar.elsegluPerspective(m_currentCamera->GetFovy(), m_currentCamera->GetAspect(), m_currentCamera->GetZNear(), m_currentCamera->GetZFar());SetClientStates(in_primitive);Transform(in_actor, in_primitive);Draw(in_primitive);UnTransform(in_actor, in_primitive);glMatrixMode(GL_PROJECTION);glPopMatrix();Int l_hit = glRenderMode(GL_RENDER);if (l_hit != 0){in_primitive->SetMinDepth(l_buffer[1]);in_primitive->SetMaxDepth(l_buffer[2]);m_picking.push_back(in_actor);}}m_witdh and m_height are the window size, in_x and in_y are the mouse position!Transform and Untransform push and pop matrices for the respective element either in 2d or 3d mode...all this setup works wonderfully for 3d objects but once there is an ortho primitive, no 3d elements can be picked! wherever i click, the ortho primtive is always return!what im im doing wrong?any help would be nice!Thx   