   centering cursor to center of screen
  Hihi.After obtaining the current mouse coordinates, i wish to position my screen so that the pointed coordinate is at the center i.e moving the scene so that the position my mouse is pointing is centered. How should i go about doing it?Thanks   
  In what; C++?I believe this isn't a OpenGL question. You have to ask this in the Software or Game Programmer forum.Any how I can give you code in C++, but if your using some other language you mite have to convert it.int cx = windowWidth;int cy = windowHeight;int iMouseX = cx >> 1;int iMouseY = cy >> 1;SetCursorPos(iMouseX, iMouseY);;  Do you want the standard FPS game movement, where moving the mouse turns the camera?If so, check the distance in pixels from the cursor to the center of the screen each frame, and adjust the camera Y rotation depending on the horizontal distance, and the X rotation depending on the vertical distance. After the adjustment, reposition the cursor to the center, so that the next frame movement will be correct relative the last.Something like 'camRotationY += (mouseX - centerX) * speed'.If you want to detect what is drawn on the screen, exactly in front of the cursor, and make sure that point is in the center of the screen, then it's an entirely different problem. If that is so, please post another reply with some more details, since it can be a complicated problem.   ;Quote:Original post by Erik RufeltDo you want the standard FPS game movement, where moving the mouse turns the camera?If so, check the distance in pixels from the cursor to the center of the screen each frame, and adjust the camera Y rotation depending on the horizontal distance, and the X rotation depending on the vertical distance. After the adjustment, reposition the cursor to the center, so that the next frame movement will be correct relative the last.Something like 'camRotationY += (mouseX - centerX) * speed'.ya i am trying to do this. i think i understand adjusting of camRotationY but i am still not sure how to reposition? but instead of repositioning the cursor, i want to reposition the scene. Or is it the same thing? kind of blur with all this.erm btw i using JOGL, so does "SetCursorPos(iMouseX, iMouseY);" applies?   ;  take a look at this,http://code.google.com/p/linuxwrath/basically i did the cursor based on http://jerome.jouvie.free.fr/OpenGl/Tutorials/Tutorial26.phpi am sure it will help.   ;Quote:Original post by TeSsLya i am trying to do this. i think i understand adjusting of camRotationY but i am still not sure how to reposition? but instead of repositioning the cursor, i want to reposition the scene. Or is it the same thing? kind of blur with all this.erm btw i using JOGL, so does "SetCursorPos(iMouseX, iMouseY);" applies?The scene should not be repositioned from turning the camera, only the view angle should be changed.You need the Java equivalent of SetCursorPos. I'm not sure what it is, but Google says to use the java.awt.Robot class, which seems to have a mouseMove(int x, int y) method.   ;Quote:Original post by linuxwrathbasically i did the cursor based on http://jerome.jouvie.free.fr/OpenGl/Tutorials/Tutorial26.phpi am sure it will help.hmm. but what if my program implements eventlistener and not scene? how should i convert this line:final ISceneTarget<?> sceneTarget = glRenderer.getSceneTarget();cause i note that glautodrawable does not have .getscenetarget.Ps. Would like to check how do i append 2 string to form a variable name? Eg. i am trying to print all the values from No1 to No10. then how do i combine the int to the "No" to form my variable name. 