Commit 2a4fb155 authored by Vladislav Vinogradov's avatar Vladislav Vinogradov

added OpenGL support to Gtk realization of highgui

parent fb2fad52
...@@ -507,6 +507,17 @@ if(UNIX) ...@@ -507,6 +507,17 @@ if(UNIX)
if(WITH_GTK) if(WITH_GTK)
CHECK_MODULE(gtk+-2.0 HAVE_GTK) CHECK_MODULE(gtk+-2.0 HAVE_GTK)
CHECK_MODULE(gthread-2.0 HAVE_GTHREAD) CHECK_MODULE(gthread-2.0 HAVE_GTHREAD)
if(WITH_OPENGL)
CHECK_MODULE(gtkglext-1.0 HAVE_GTKGLEXT)
if(HAVE_GTKGLEXT)
find_package(OpenGL QUIET)
if(OPENGL_FOUND)
set(HAVE_OPENGL 1)
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${OPENGL_LIBRARIES})
include_directories(${OPENGL_INCLUDE_DIR})
endif()
endif()
endif()
else() else()
set(HAVE_GTK FALSE) set(HAVE_GTK FALSE)
set(HAVE_GTHREAD FALSE) set(HAVE_GTHREAD FALSE)
...@@ -1125,10 +1136,10 @@ if(WIN32) ...@@ -1125,10 +1136,10 @@ if(WIN32)
endif() endif()
endif() endif()
if (WITH_OPENGL AND NOT HAVE_QT_OPENGL) if(WITH_OPENGL AND NOT HAVE_QT_OPENGL)
find_package(OpenGL QUIET) find_package(OpenGL QUIET)
if (OPENGL_FOUND) if(OPENGL_FOUND)
set(HAVE_OPENGL 1) set(HAVE_OPENGL 1)
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${OPENGL_LIBRARIES}) set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${OPENGL_LIBRARIES})
include_directories(${OPENGL_INCLUDE_DIR}) include_directories(${OPENGL_INCLUDE_DIR})
...@@ -1725,7 +1736,8 @@ else() ...@@ -1725,7 +1736,8 @@ else()
endif() endif()
else() else()
status(" GTK+ 2.x:" HAVE_GTK THEN YES ELSE NO) status(" GTK+ 2.x:" HAVE_GTK THEN YES ELSE NO)
status(" GThread:" HAVE_GTHREAD THEN YES ELSE NO) status(" GThread :" HAVE_GTHREAD THEN YES ELSE NO)
status(" GtkGlExt:" HAVE_GTKGLEXT THEN YES ELSE NO)
endif() endif()
endif() endif()
endif() endif()
......
...@@ -186,8 +186,13 @@ double cvGetModeWindow_GTK(const char* name); ...@@ -186,8 +186,13 @@ double cvGetModeWindow_GTK(const char* name);
double cvGetModeWindow_CARBON(const char* name); double cvGetModeWindow_CARBON(const char* name);
double cvGetPropWindowAutoSize_W32(const char* name); double cvGetPropWindowAutoSize_W32(const char* name);
double cvGetPropWindowAutoSize_GTK(const char* name);
double cvGetRatioWindow_W32(const char* name); double cvGetRatioWindow_W32(const char* name);
double cvGetRatioWindow_GTK(const char* name);
double cvGetOpenGlProp_W32(const char* name); double cvGetOpenGlProp_W32(const char* name);
double cvGetOpenGlProp_GTK(const char* name);
//for QT //for QT
#if defined (HAVE_QT) #if defined (HAVE_QT)
......
...@@ -109,6 +109,8 @@ CV_IMPL double cvGetWindowProperty(const char* name, int prop_id) ...@@ -109,6 +109,8 @@ CV_IMPL double cvGetWindowProperty(const char* name, int prop_id)
return cvGetPropWindow_QT(name); return cvGetPropWindow_QT(name);
#elif defined WIN32 || defined _WIN32 #elif defined WIN32 || defined _WIN32
return cvGetPropWindowAutoSize_W32(name); return cvGetPropWindowAutoSize_W32(name);
#elif defined (HAVE_GTK)
return cvGetPropWindowAutoSize_GTK(name);
#else #else
return -1; return -1;
#endif #endif
...@@ -120,6 +122,8 @@ CV_IMPL double cvGetWindowProperty(const char* name, int prop_id) ...@@ -120,6 +122,8 @@ CV_IMPL double cvGetWindowProperty(const char* name, int prop_id)
return cvGetRatioWindow_QT(name); return cvGetRatioWindow_QT(name);
#elif defined WIN32 || defined _WIN32 #elif defined WIN32 || defined _WIN32
return cvGetRatioWindow_W32(name); return cvGetRatioWindow_W32(name);
#elif defined (HAVE_GTK)
return cvGetRatioWindow_GTK(name);
#else #else
return -1; return -1;
#endif #endif
...@@ -130,6 +134,8 @@ CV_IMPL double cvGetWindowProperty(const char* name, int prop_id) ...@@ -130,6 +134,8 @@ CV_IMPL double cvGetWindowProperty(const char* name, int prop_id)
#if defined (HAVE_QT) #if defined (HAVE_QT)
#elif defined WIN32 || defined _WIN32 #elif defined WIN32 || defined _WIN32
return cvGetOpenGlProp_W32(name); return cvGetOpenGlProp_W32(name);
#elif defined (HAVE_GTK)
return cvGetOpenGlProp_GTK(name);
#else #else
return -1; return -1;
#endif #endif
......
This diff is collapsed.
...@@ -214,6 +214,8 @@ int main(int argc, const char* argv[]) ...@@ -214,6 +214,8 @@ int main(int argc, const char* argv[])
while (true) while (true)
{ {
int key = waitKey(1); int key = waitKey(1);
if (key >= 0)
key = key & 0xff;
if (key == 27) if (key == 27)
break; break;
...@@ -221,7 +223,13 @@ int main(int argc, const char* argv[]) ...@@ -221,7 +223,13 @@ int main(int argc, const char* argv[])
double aspect = getWindowProperty("OpenGL Sample", WND_PROP_ASPECT_RATIO); double aspect = getWindowProperty("OpenGL Sample", WND_PROP_ASPECT_RATIO);
const double posStep = 0.1; const double posStep = 0.1;
#ifdef _WIN32
const double mouseStep = 0.001; const double mouseStep = 0.001;
#else
const double mouseStep = 0.000001;
#endif
const int mouseClamp = 300; const int mouseClamp = 300;
camera.setPerspectiveProjection(30.0 + fov / 100.0 * 40.0, aspect, 0.1, 1000.0); camera.setPerspectiveProjection(30.0 + fov / 100.0 * 40.0, aspect, 0.1, 1000.0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment