   openGL
  I am working on a simple 2D program, right now i jsut want to be able to click on a square object, and then click on a new location and have the object move there. I have the picking working, but when i click the secound time to place the object it just goes away, i think this is because when i try to move it to the mouse coords it moves the object to a location that is far off the screen. I am new to openGL and am not sure how to fix this problem, can anyone help me out?   
  You probably need to set orthographic projection with the same dimension as the window, so to match the window with the eyespace coords. If, for example, you have a 640x480(and the mouse coordinates are in respect to the window, not the screen), you would need to setup glOrtho(0,640,480,0,-1,1);   ;  Yah, i have the orthonormal view thing but i must be missing something else, my code is basically jsut an edited version from the NeHe tutorial where they replace the cursor with a crosshair:glMatrixMode(GL_PROJECTION);glPushMatrix();glLoadIdentity();glOrtho(0,640,480,0,-1,1);glMatrixMode(GL_MODELVIEW);glTranslated(mouse_x,480-mouse_y,0.0f); Object(1,1,0);the tutorial had "glOrtho(0,window.right,0,window.bottom,-1,1);"void Object(float width,float height,GLuint texid)// Draw Object Using Requested Width, Height And Texture{glBindTexture(GL_TEXTURE_2D, texture[0]);glBegin(GL_QUADS);glTexCoord2f(0.0f,0.0f); glVertex3f(-width,-height,0.0f);glTexCoord2f(1.0f,0.0f); glVertex3f( width,-height,0.0f);glTexCoord2f(1.0f,1.0f); glVertex3f( width, height,0.0f);glTexCoord2f(0.0f,1.0f); glVertex3f(-width, height,0.0f);glEnd();}I am just trying to throw this toghter quickly, so i am probably missing some small detail, but i have been over it a few times and i do not see why the above code does not work.   ;  Change the code to this:glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); glOrtho(0,640,480,0,-1,1); glMatrixMode(GL_MODELVIEW);glLoadIdentity();//reset the matrix//push and pop so that the translation for the particular object doesn't affect the rest of the sceneglPushMatrix();glTranslated(mouse_x,480-mouse_y,0.0f); Object(1,1,0);glPopMatrix();The way you were doing it, the glTranslated were accumulated in each frame and moved the object far away. Btw, the ortho could be (0,640,480,0) or (0,640,0,480), I can't recall exactly how it works. I think though that with my arrangement you don't have to do 480-mouse_y. Anyway, if it looks wrong, just reverse it.   ;  cool, that worked, thank you.   ;  One last question, i have it now so that the object will follow the cursor around, but then i need to be able to place the object in a new location. I could keep drawing it using the orthographic projection, but it would be best if i could change the x, y mouse coords to something that would work with my normal code for objects:glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);glLoadIdentity();DrawTargets();glPopMatrix();void DrawTargets(void){glLoadIdentity();glTranslatef(0.0f,0.0f,-10.0f);for (int loop=0; loop<1; loop++){glLoadName(loop);glPushMatrix(); glTranslatef(object[loop].x,object[loop].y,object[loop].distance);   Object(1,1,0);glPopMatrix();}}   