Drawing A Cursor
I''m in the process of writing my first OpenGL application, so please excuse my possibly bad code/ideas. My app is written in Win32. I''m not having any major problems except this one: when the mouse pointer passes over the window, the cursor repeatedly flickers, since the OpenGL scene is rendered, then the cursor is drawn.
I was trying to think of a way to get around this, and I came up with this idea: why not disable the mouse cursor''s visibility, then catch the WM_MOUSEMOVE message and call a DrawCursor() function, then render the rest of the scene at the same time? In my DrawCursor function, I''ve used the gluUnProject() method to try to convert the screen coordinates into object coordinates, then draw a simple polygon at that position, but I can''t get it to work right. When I run the debugger, the values I get in object coordinates are very very small floating point numbers, which cannot be correct. I have a couple questions.
1. Is this even a remotely do-able approach?
2. If so, what value should I pass to gluUnProject() for the z-coordinate on the screen? Since the cursor is floating above the window, wouldn''t its z-coordinate be 0?
I''d really appreciate if any of the gurus could give me a little guidance on this one. Again, sorry if this is a terribly newbie question, I really would like to be able to show a mouse cursor, but not if it keeps flickering! Thanks.
first the cursor shouldnt flicker, dont use a drawcursor() call.
or if you want opengl to draw the cursor eg if u want a 3d cursor
no need for a gluunproject you know the x,y position of the cursor. just set up an orthogonal matrix + draw the cursor at (x,y)
http://members.xoom.com/myBollux
or if you want opengl to draw the cursor eg if u want a 3d cursor
no need for a gluunproject you know the x,y position of the cursor. just set up an orthogonal matrix + draw the cursor at (x,y)
http://members.xoom.com/myBollux
I don''t mean to be a newbie, but could you go into a little more detail on how I would set up an orthogonal matrix to solve this problem? I have very little experience in this area, and I appreciate any help you can give me here. Thanks.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement