I was trying to use wm_mousemove in an OpenGL project to create a custom mouse cursor. If i use:
because glOrtho doesn't use depth so the mouse coordinate will be easy to determine where it is on the screen. But if i use this:Code:glOrtho(0.0f, 800, 600, 0.0f, -10.0f, 10.0f);
It didn't work so well. Because of the depth, so when i put the coordinate of the mouse in glTranslatef(), it won't display on the screen.Code:gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f);
This is the mouse move code in glOrtho();
So can anyone show me how to do it in gluPerspective() please. ThanksCode:glLoadIdentity(); mouseX = x_mouse; mouseY = y_mouse; glTranslatef(mouseX, mouseY, 0); glBegin(GL_QUADS); glVertex2f(0, 0); glVertex2f(20, 0); glVertex2f(20, 20); glVertex2f(0, 20); glEnd(); .......................... //determine the coordinate of the mouse case WM_MOUSEMOVE: { x_mouse = LOWORD(lParam); y_mouse = HIWORD(lParam); return 0; }



LinkBack URL
About LinkBacks


