This commit is contained in:
Yannick Verdie 2010-07-26 12:28:33 +00:00
parent 769564c130
commit bb2fe87b32
4 changed files with 22 additions and 28 deletions

View File

@ -516,11 +516,14 @@ if (WITH_QT)
find_package(Qt4) find_package(Qt4)
if (QT4_FOUND) if (QT4_FOUND)
set(HAVE_QT 1) set(HAVE_QT 1)
find_package (OpenGL QUIET) #add_definitions(-DHAVE_QT)
if (QT_QTOPENGL_FOUND AND OPENGL_FOUND) set_property(DIRECTORY PROPERTY COMPILE_DEFINITIONS "HAVE_QT")
set(HAVE_QT_OPENGL 1)
add_definitions(-DHAVE_QT_OPENGL) #find_package (OpenGL QUIET)
endif() #if (QT_QTOPENGL_FOUND AND OPENGL_FOUND)
# set(HAVE_QT_OPENGL 1)
# add_definitions(-DHAVE_QT_OPENGL)
#endif()
endif() endif()
endif() endif()

View File

@ -368,61 +368,51 @@ CV_IMPL int cvStartWindowThread()
CV_IMPL void cvAddText( const CvArr*, const char*, CvPoint org, CvFont font) CV_IMPL void cvAddText( const CvArr*, const char*, CvPoint org, CvFont font)
{ {
CV_NO_GUI_ERROR("cvAddText"); CV_NO_GUI_ERROR("cvAddText");
return -1;
} }
CV_IMPL void cvDisplayStatusBar(const char* name, const char* arg2, int arg3) CV_IMPL void cvDisplayStatusBar(const char* name, const char* arg2, int arg3)
{ {
CV_NO_GUI_ERROR("cvDisplayStatusBar"); CV_NO_GUI_ERROR("cvDisplayStatusBar");
return -1;
} }
CV_IMPL void cvDisplayStatusBar(const char* name, const char* arg2, int arg3) CV_IMPL void cvDisplayStatusBar(const char* name, const char* arg2, int arg3)
{ {
CV_NO_GUI_ERROR("cvDisplayStatusBar"); CV_NO_GUI_ERROR("cvDisplayStatusBar");
return -1;
} }
CV_IMPL void cvCreateOpenGLCallback(const char* name, cvOpenGLCallback callback, void* param) CV_IMPL void cvCreateOpenGLCallback(const char* name, cvOpenGLCallback callback, void* param)
{ {
CV_NO_GUI_ERROR("createOpenGLCallback"); CV_NO_GUI_ERROR("createOpenGLCallback");
return -1;
} }
CV_IMPL void cvDisplayOverlay(const char* name, const char* text, int delayms) CV_IMPL void cvDisplayOverlay(const char* name, const char* text, int delayms)
{ {
CV_NO_GUI_ERROR("cvNamedWindow"); CV_NO_GUI_ERROR("cvNamedWindow");
return -1;
} }
CV_IMPL void cvStartLoop(int (*pt2Func)(int argc, char *argv[]), int argc, char* argv[]) CV_IMPL void cvStartLoop(int (*pt2Func)(int argc, char *argv[]), int argc, char* argv[])
{ {
CV_NO_GUI_ERROR("cvStartLoop"); CV_NO_GUI_ERROR("cvStartLoop");
return -1;
} }
CV_IMPL void cvStopLoop() CV_IMPL void cvStopLoop()
{ {
CV_NO_GUI_ERROR("cvStopLoop"); CV_NO_GUI_ERROR("cvStopLoop");
return -1;
} }
CV_IMPL void cvSaveWindowParameters(const char* name) CV_IMPL void cvSaveWindowParameters(const char* name)
{ {
CV_NO_GUI_ERROR("cvSaveWindowParameters"); CV_NO_GUI_ERROR("cvSaveWindowParameters");
return -1;
} }
CV_IMPL void cvLoadWindowParameterss(const char* name) CV_IMPL void cvLoadWindowParameterss(const char* name)
{ {
CV_NO_GUI_ERROR("cvLoadWindowParameters"); CV_NO_GUI_ERROR("cvLoadWindowParameters");
return -1;
} }
CV_IMPL void cvCreateButton(const char* arg1, const char* arg2, cvButtonCallback on_change, const char* name, void* userdata) CV_IMPL void cvCreateButton(const char* arg1, const char* arg2, cvButtonCallback on_change, const char* name, void* userdata)
{ {
CV_NO_GUI_ERROR("cvCreateButton"); CV_NO_GUI_ERROR("cvCreateButton");
return -1;
} }

View File

@ -39,7 +39,7 @@
//--------------------Google Code 2010 -- Yannick Verdie--------------------// //--------------------Google Code 2010 -- Yannick Verdie--------------------//
#ifdef HAVE_QT #if defined(HAVE_QT)
#include <window_QT.h> #include <window_QT.h>
@ -266,7 +266,7 @@ CV_IMPL int cvWaitKey( int arg )
*/ */
#if defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64 #if defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64
sleep(2); Sleep(2);
#else #else
usleep(2);//to decrease CPU usage usleep(2);//to decrease CPU usage
#endif #endif
@ -394,7 +394,7 @@ int icvInitSystem()
wasInitialized = 1; wasInitialized = 1;
qDebug()<<"init done"; qDebug()<<"init done";
#if defined(HAVE_QT_OPENGL)//OK tested ! #if defined( HAVE_QT_OPENGL )//OK tested !
qDebug()<<"opengl support available"; qDebug()<<"opengl support available";
#endif #endif
} }
@ -1255,7 +1255,7 @@ CvWindow::CvWindow(QString arg, int arg2)
//2: my view //2: my view
int mode_display = CV_MODE_NORMAL; int mode_display = CV_MODE_NORMAL;
#if defined(HAVE_QT_OPENGL) #if defined( HAVE_QT_OPENGL )
mode_display = CV_MODE_OPENGL; mode_display = CV_MODE_OPENGL;
#endif #endif
createView(mode_display); createView(mode_display);
@ -1718,7 +1718,7 @@ ViewPort::ViewPort(CvWindow* arg, int arg2, int arg3)
on_openGL_draw3D = NULL; on_openGL_draw3D = NULL;
#if defined(HAVE_QT_OPENGL) #if defined( HAVE_QT_OPENGL )
if ( mode_display == CV_MODE_OPENGL) if ( mode_display == CV_MODE_OPENGL)
{ {
//QGLWidget* wGL = new QGLWidget(QGLFormat(QGL::SampleBuffers)); //QGLWidget* wGL = new QGLWidget(QGLFormat(QGL::SampleBuffers));
@ -1777,7 +1777,7 @@ void ViewPort::saveView()
{ {
QString extension = fileName.right(3); QString extension = fileName.right(3);
#if defined(HAVE_QT_OPENGL) #if defined( HAVE_QT_OPENGL )
image2Draw_qt_resized = ((QGLWidget*)viewport())->grabFrameBuffer(); image2Draw_qt_resized = ((QGLWidget*)viewport())->grabFrameBuffer();
#else #else
QPainter saveimage(&image2Draw_qt_resized); QPainter saveimage(&image2Draw_qt_resized);
@ -1928,6 +1928,7 @@ void ViewPort::setMouseCallBack(CvMouseCallback m, void* param)
void ViewPort::setOpenGLCallback(CvOpenGLCallback func,void* userdata, double angle_arg, double zmin_arg, double zmax_arg) void ViewPort::setOpenGLCallback(CvOpenGLCallback func,void* userdata, double angle_arg, double zmin_arg, double zmax_arg)
{ {
#if defined( HAVE_QT_OPENGL )//all this section -> not tested
on_openGL_draw3D = func; on_openGL_draw3D = func;
on_openGL_param = userdata; on_openGL_param = userdata;
@ -1947,7 +1948,7 @@ void ViewPort::setOpenGLCallback(CvOpenGLCallback func,void* userdata, double an
zmax = zmax_arg; zmax = zmax_arg;
else else
zmax = DEFAULT_ZMAX; zmax = DEFAULT_ZMAX;
#endif
} }
void ViewPort::controlImagePosition() void ViewPort::controlImagePosition()
@ -2219,7 +2220,7 @@ void ViewPort::paintEvent(QPaintEvent* event)
draw2D(&myPainter); draw2D(&myPainter);
#if defined(HAVE_QT_OPENGL) #if defined( HAVE_QT_OPENGL )
if ( mode_display == CV_MODE_OPENGL && on_openGL_draw3D) if ( mode_display == CV_MODE_OPENGL && on_openGL_draw3D)
{ {
myPainter.save(); // Needed when using the GL1 engine myPainter.save(); // Needed when using the GL1 engine
@ -2423,7 +2424,7 @@ void ViewPort::drawInstructions(QPainter *painter)
#if defined(HAVE_QT_OPENGL)//all this section -> not tested #if defined( HAVE_QT_OPENGL )//all this section -> not tested
void ViewPort::initGL() void ViewPort::initGL()
{ {

View File

@ -43,9 +43,9 @@
#include "precomp.hpp" #include "precomp.hpp"
#if defined(HAVE_QT_OPENGL)//OPENCV_GL) #if defined( HAVE_QT_OPENGL )
#include <QtOpenGL> #include <QtOpenGL>
#include <QGLWidget> #include <QGLWidget>
#endif #endif
#include <QAbstractEventDispatcher> #include <QAbstractEventDispatcher>
@ -411,7 +411,7 @@ private:
void icvmouseHandler(QMouseEvent *event, type_mouse_event category, int &cv_event, int &flags); void icvmouseHandler(QMouseEvent *event, type_mouse_event category, int &cv_event, int &flags);
void icvmouseProcessing(QPointF pt, int cv_event, int flags); void icvmouseProcessing(QPointF pt, int cv_event, int flags);
#if defined(HAVE_QT_OPENGL) #if defined( HAVE_QT_OPENGL )
double angle; double angle;
double zmin; double zmin;
double zmax; double zmax;