Hi all,
I’m new to Open GL programming. I have developed one application,
where in which I was able to display a bmp image and also able to bind it to a polygon top face.
Now my requirment is such that, I want to display the run time X & Y axis values based on the mouse click. ( example, when u open an image in linux, when ever mouse pointer changes, x y values also varies…) Now i want this feature to be in my application.
Pls, if any one has done coding, help me out guys!!
Thanks
int lastDirectionX, lastDirectionY;
void mouse ( int button, int state, int x, int y )
{
lastDirectionX = x;
lastDirectionY = y;
}
And in your main, add:
glutMouseFunc(mouse);
This only works when the user press the button of the mouse.
void mouse (int x, int y )
{
lastDirectionX = x;
lastDirectionY = y;
}
And in your main, add:
glutPassiveMotionFunc(mouse)
This works all the time so you can know in every moment where the mouse is. I imagine that function is heavy so it is called too many times.
Now, you only have to show tha values of the global variables.
thanks Saar. it was a timely help from you.
Thank you very much.
I tried the second method, which works fine for me… For 1st one i already defined some other operation, so settled for 2nd.