Hi,
I want to use a callback function for mouse inside an openGL windows. My program looks like :
static void onMouse(int event, int x, int y, int, void*)
{
if (event==EVENT_LBUTTONDOWN)
{
prevX=x;
prevY=y;
}
if (event == EVENT_LBUTTONUP)
{
prevX=-1;
prevY=-1;
}
if (prevX!=-1)
{
obsX += x - prevX;
obsY += y - prevY;
}
cout << event << "\t" << x << "\t" << y << "\t" << prevX << "\t" << prevY << "\n";
}
void DrawOpenGLMSER(Mat img, Mat result)
{
Mat imgGray;
if (img.type() != CV_8UC1)
cvtColor(img, imgGray, COLOR_BGR2GRAY);
else
imgGray = img;
namedWindow("OpenGL", WINDOW_OPENGL);
//resizeWindow("OpenGL", win_width, win_height);
setMouseCallback("OpenGL", onMouse, NULL);.......
About Opengl everything works fine but mouse inside OpenGL windows does not work. I can see event but mouse position is always 0,0. (when I run opencv/samples/cpp/ffilldemo.cpp I can see mouse coordinates)
Help would be appreciate thanks.