/*===========================================================================*/ void ScreenBase::create() { KVS_ASSERT( m_id == -1 ); // Initialize display mode. QGLFormat f = QGLFormat::defaultFormat(); f.setDoubleBuffer( displayFormat().doubleBuffer() ); f.setRgba( displayFormat().colorBuffer() ); f.setDepth( displayFormat().depthBuffer() ); f.setAccum( displayFormat().accumulationBuffer() ); f.setStencil( displayFormat().stencilBuffer() ); f.setStereo( displayFormat().stereoBuffer() ); f.setSampleBuffers( displayFormat().multisampleBuffer() ); f.setAlpha( displayFormat().alphaChannel() ); QGLFormat::setDefaultFormat( f ); // Set screen geometry. QWidget::setGeometry( BaseClass::x(), BaseClass::y(), BaseClass::width(), BaseClass::height() ); QGLWidget::makeCurrent(); // Initialize GLEW. GLenum result = glewInit(); if ( result != GLEW_OK ) { const GLubyte* message = glewGetErrorString( result ); kvsMessageError( "GLEW initialization failed: %s.", message ); } // Create window. static int counter = 0; m_id = counter++; }
/*===========================================================================*/ int Screen::show( void ) { // Initialize display mode. unsigned int mode = 0; if ( displayFormat().doubleBuffer() ) mode |= GLUT_DOUBLE; else mode |= GLUT_SINGLE; if ( displayFormat().colorBuffer() ) mode |= GLUT_RGBA; else mode |= GLUT_INDEX; if ( displayFormat().depthBuffer() ) mode |= GLUT_DEPTH; if ( displayFormat().accumulationBuffer() ) mode |= GLUT_ACCUM; if ( displayFormat().stencilBuffer() ) mode |= GLUT_STENCIL; if ( displayFormat().stereoBuffer() ) mode |= GLUT_STEREO; if ( displayFormat().multisampleBuffer() ) mode |= GLUT_MULTISAMPLE; if ( displayFormat().alphaChannel() ) mode |= GLUT_ALPHA; glutInitDisplayMode( mode ); if ( kvs::tdw::Application::IsRenderer() ) { if ( kvs::tdw::Configuration::IsFullScreen() ) { // Create window. this->createWindow(); this->showFullScreen(); } else { // Set screen geometry. glutInitWindowPosition( m_x, m_y ); glutInitWindowSize( m_width, m_height ); // Create window. this->createWindow(); } } else { // Set screen geometry. glutInitWindowPosition( m_x, m_y ); glutInitWindowSize( m_width, m_height ); // Create window. this->createWindow(); } return( BaseClass::id() ); }
/**************************************************************************** REMARKS: Does a simple overlay buffer static video capture test. The overlay will show what is coming in via the video capture engine. ****************************************************************************/ static int staticTest( GA_videoFuncs *video, GA_videoCaptureFuncs *capture, GA_captureInputTypes input, GA_captureStandardTypes standard, GA_VideoCaptureInf *captureInfo) { int key,x,y,width = DEF_WIDTH,height = DEF_HEIGHT; int centerX, centerY; ibool done = false,freezeInput = false,newFreezeInput = false; GA_captureBuf *captureBuf = NULL; GA_buf *primaryVideo = NULL; int outputHead = init.GetActiveHead(); char str[80]; /* Draw background for video overlay */ SetActivePage(0); ClearPage(0); moire(defcolor); if (maxX >= 479) gmoveto(80,80); else gmoveto(8,40); gprintf("Video capture static test"); y += 16; displaymodeInfo(); gprintf("Press any key to continue"); if (EVT_getch() == 0x1B) return 0x1B; /* Use larger overlay window for higher resolutions */ if (modeInfo.XResolution >= 1280) { width *= 2; height *= 2; } else if (modeInfo.XResolution <= DEF_WIDTH) { width /= 2; height /= 2; } /* Allocate the source video buffer */ if ((captureBuf = capture->AllocCaptureBuffer(width,height,captureInfo->VideoFormat,1)) == NULL) { displayError("Unable to allocate video capture buffer!"); return 0x1B; } primaryVideo = captureBuf->VideoBuffers; centerX = (maxX - primaryVideo->Width)/2; centerY = (maxY - primaryVideo->Height)/2; /* Set up for single buffer video overlay */ SetActiveBuffer(primaryVideo); ClearVideoBuffer(primaryVideo); /* Set the video output window */ x = centerX; y = centerY; if (!video->SetVideoOutput(0,outputHead,primaryVideo, 0,0,primaryVideo->Width,primaryVideo->Height, x,y,primaryVideo->Width,primaryVideo->Height,0)) { displayError("Unable to set video output window!"); return 0x1B; } /* Set up the video capture and start it */ capture->SetVideoInput(captureBuf,input,standard,0,false); capture->StartLiveVideo(captureBuf); /* Now loop around and display the video capture */ sprintf(str,"%d x %d %d bit %s overlay",primaryVideo->Width,primaryVideo->Height, primaryVideo->BitsPerPixel,displayFormat(primaryVideo->Format)); if (width < DEF_WIDTH) WriteText(8,60,displayFormat(primaryVideo->Format),defcolor); else WriteText(8,80,str,defcolor); while (!done) { if (handleKeypress(&key,&newFreezeInput)) break; if (freezeInput != newFreezeInput) { freezeInput = newFreezeInput; if (freezeInput) capture->FreezeLiveVideo(captureBuf,gaCaptureFieldAny); else capture->StartLiveVideo(captureBuf); } } SetActivePage(0); video->DisableVideoOutput(0); capture->FreeCaptureBuffer(captureBuf); return key; }
int QDateTimeEdit::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QAbstractSpinBox::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 7) qt_static_metacall(this, _c, _id, _a); _id -= 7; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< QDateTime*>(_v) = dateTime(); break; case 1: *reinterpret_cast< QDate*>(_v) = date(); break; case 2: *reinterpret_cast< QTime*>(_v) = time(); break; case 3: *reinterpret_cast< QDateTime*>(_v) = maximumDateTime(); break; case 4: *reinterpret_cast< QDateTime*>(_v) = minimumDateTime(); break; case 5: *reinterpret_cast< QDate*>(_v) = maximumDate(); break; case 6: *reinterpret_cast< QDate*>(_v) = minimumDate(); break; case 7: *reinterpret_cast< QTime*>(_v) = maximumTime(); break; case 8: *reinterpret_cast< QTime*>(_v) = minimumTime(); break; case 9: *reinterpret_cast< Section*>(_v) = currentSection(); break; case 10: *reinterpret_cast<int*>(_v) = QFlag(displayedSections()); break; case 11: *reinterpret_cast< QString*>(_v) = displayFormat(); break; case 12: *reinterpret_cast< bool*>(_v) = calendarPopup(); break; case 13: *reinterpret_cast< int*>(_v) = currentSectionIndex(); break; case 14: *reinterpret_cast< int*>(_v) = sectionCount(); break; case 15: *reinterpret_cast< Qt::TimeSpec*>(_v) = timeSpec(); break; } _id -= 16; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setDateTime(*reinterpret_cast< QDateTime*>(_v)); break; case 1: setDate(*reinterpret_cast< QDate*>(_v)); break; case 2: setTime(*reinterpret_cast< QTime*>(_v)); break; case 3: setMaximumDateTime(*reinterpret_cast< QDateTime*>(_v)); break; case 4: setMinimumDateTime(*reinterpret_cast< QDateTime*>(_v)); break; case 5: setMaximumDate(*reinterpret_cast< QDate*>(_v)); break; case 6: setMinimumDate(*reinterpret_cast< QDate*>(_v)); break; case 7: setMaximumTime(*reinterpret_cast< QTime*>(_v)); break; case 8: setMinimumTime(*reinterpret_cast< QTime*>(_v)); break; case 9: setCurrentSection(*reinterpret_cast< Section*>(_v)); break; case 11: setDisplayFormat(*reinterpret_cast< QString*>(_v)); break; case 12: setCalendarPopup(*reinterpret_cast< bool*>(_v)); break; case 13: setCurrentSectionIndex(*reinterpret_cast< int*>(_v)); break; case 15: setTimeSpec(*reinterpret_cast< Qt::TimeSpec*>(_v)); break; } _id -= 16; } else if (_c == QMetaObject::ResetProperty) { switch (_id) { case 3: clearMaximumDateTime(); break; case 4: clearMinimumDateTime(); break; case 5: clearMaximumDate(); break; case 6: clearMinimumDate(); break; case 7: clearMaximumTime(); break; case 8: clearMinimumTime(); break; } _id -= 16; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 16; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 16; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 16; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 16; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 16; } #endif // QT_NO_PROPERTIES return _id; }