GLSLWaveformWidget::GLSLWaveformWidget(const char* group, QWidget* parent, bool rgbRenderer) : QGLWidget(parent, SharedGLContext::getWidget()), WaveformWidgetAbstract(group) { addRenderer<WaveformRenderBackground>(); addRenderer<WaveformRendererEndOfTrack>(); addRenderer<WaveformRendererPreroll>(); addRenderer<WaveformRenderMarkRange>(); if (rgbRenderer) { signalRenderer_ = addRenderer<GLSLWaveformRendererRGBSignal>(); } else { signalRenderer_ = addRenderer<GLSLWaveformRendererFilteredSignal>(); } addRenderer<WaveformRenderBeat>(); addRenderer<WaveformRenderMark>(); setAttribute(Qt::WA_NoSystemBackground); setAttribute(Qt::WA_OpaquePaintEvent); setAutoBufferSwap(false); qDebug() << "Created QGLWidget. Context" << "Valid:" << context()->isValid() << "Sharing:" << context()->isSharing(); // Initialization requires activating our context. if (QGLContext::currentContext() != context()) { makeCurrent(); } m_initSuccess = init(); }
GLWidgetRenderer::GLWidgetRenderer(QWidget *parent, const QGLWidget* shareWidget, Qt::WindowFlags f): QGLWidget(parent, shareWidget, f),VideoRenderer(*new GLWidgetRendererPrivate()) { DPTR_INIT_PRIVATE(GLWidgetRenderer); DPTR_D(GLWidgetRenderer); setPreferredPixelFormat(VideoFormat::Format_YUV420P); setAcceptDrops(true); setFocusPolicy(Qt::StrongFocus); /* To rapidly update custom widgets that constantly paint over their entire areas with * opaque content, e.g., video streaming widgets, it is better to set the widget's * Qt::WA_OpaquePaintEvent, avoiding any unnecessary overhead associated with repainting the * widget's background */ setAttribute(Qt::WA_OpaquePaintEvent); setAttribute(Qt::WA_PaintOnScreen); setAttribute(Qt::WA_NoSystemBackground); //default: swap in qpainter dtor. we should swap before QPainter.endNativePainting() setAutoBufferSwap(false); setAutoFillBackground(false); d.painter = new QPainter(); d.filter_context = FilterContext::create(FilterContext::QtPainter); QPainterFilterContext *ctx = static_cast<QPainterFilterContext*>(d.filter_context); ctx->paint_device = this; ctx->painter = d.painter; setOSDFilter(new OSDFilterQPainter()); }
GLRGBWaveformWidget::GLRGBWaveformWidget(const char* group, QWidget* parent) : QGLWidget(parent, SharedGLContext::getWidget()), WaveformWidgetAbstract(group) { addRenderer<WaveformRenderBackground>(); addRenderer<WaveformRendererEndOfTrack>(); addRenderer<WaveformRendererPreroll>(); addRenderer<WaveformRenderMarkRange>(); addRenderer<GLWaveformRendererRGB>(); addRenderer<WaveformRenderBeat>(); addRenderer<WaveformRenderMark>(); setAttribute(Qt::WA_NoSystemBackground); setAttribute(Qt::WA_OpaquePaintEvent); setAutoBufferSwap(false); qDebug() << "Created QGLWidget. Context" << "Valid:" << context()->isValid() << "Sharing:" << context()->isSharing(); if (QGLContext::currentContext() != context()) { makeCurrent(); } m_initSuccess = init(); }
QtCanvas::QtCanvas(const std::string& title, const ivec2& size, const Buffers buffers, QWidget* parent, bool shared, Qt::WFlags f, char* /*name*/) : GLCanvas(title, size, buffers) , QGLWidget(getQGLFormat(buffers), parent, (shared ? shareWidget_ : 0), f) { resize(size.x, size.y); if (shared && shareWidget_ == 0) shareWidget_ = this; setWindowTitle(QString(title.c_str())); setFocusPolicy(Qt::StrongFocus); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); // we have our own AutoBufferSwap-mechanism (GLCanvas::setAutoFlush), so disable the one of qt setAutoBufferSwap(false); rgbaSize_ = ivec4(format().redBufferSize(), format().greenBufferSize(), format().blueBufferSize(), format().alphaBufferSize()); stencilSize_ = format().stencilBufferSize(); depthSize_ = format().depthBufferSize(); doubleBuffered_ = doubleBuffer(); stereoViewing_ = format().stereo(); }
ThreadedGLWidgetWrapper::ThreadedGLWidgetWrapper(QWidget *parent) : QGLWidget(parent), glt(this) { init(); //stimContainerDlg = NULL; bForceToStop = false; bDebugMode = false; #ifdef Q_WS_MACX nMinScreenUpdateTime = 1; // make param in interface and recommend per platform #else nMinScreenUpdateTime = 1; // on Win (with recent OGL drivers), "swapBuffers" will wait for n retraces as indicated by "setSwapInterval" command (works like DX "flip") #endif setAutoFillBackground(false); setAutoBufferSwap(false); // in order to have control over time point for buffer swap //dDesktopWidget = QApplication::desktop(); rScreenResolution = QApplication::desktop()->screenGeometry();//dDesktopWidget->screenGeometry();//availableGeometry(); setFixedSize(rScreenResolution.width(), rScreenResolution.height()); //setMinimumSize(200, 200); setWindowTitle(tr("Painting a Scene")); //resize(320, 240); //stimContainerDlg = new TreadedContainerDlg();//parent parameter? //stimContainerDlg->setAttribute(Qt::WA_DeleteOnClose); //retinoMapWdg = new RetinoMap_glwidget(stimContainerDlg); //retinoMapWdg->setObjectName("RetinoMap_RenderWidgetGL"); //stimContainerDlg->installEventFilter(this);//re-route all stimContainerDlg events to this->bool Retinotopic_Mapping::eventFilter(QObject *target, QEvent *event) parent->installEventFilter(this); mainLayout = NULL; }
VisualizerWidget::VisualizerWidget(QWidget* parent) : QGLWidget(parent) , m_renderer(this) { setAutoBufferSwap(false); m_renderer.start(); }
void GLWidget::initializeGL() { // glEnable(GL_LIGHTING); // glEnable(GL_LIGHT0); setAutoBufferSwap(false); // We do not want blending by now glDisable(GL_BLEND); // We do not want depth test by now glDisable(GL_DEPTH_TEST); /** FIXME If the line below is uncommented, the program crashes. I could not trace the problem of the crash. If you happen to know where it it, please, let me know. Lisandro. */ // glEnableClientState(GL_NORMAL_ARRAY); if(fileRender) { emit rebuildLists(); } }
GLWidget::GLWidget( const QGLFormat& format_, const QGLWidget* shareWidget ) : QGLWidget( format_, 0, shareWidget ) , _parent( 0 ) , _eventHandler( 0 ) { setAutoBufferSwap( false ); }
GLWidget::GLWidget(QWidget *parent) : QGLWidget(parent), timer(new QBasicTimer) { setAttribute(Qt::WA_PaintOnScreen); setAttribute(Qt::WA_NoSystemBackground); setAutoBufferSwap(false); model = new Model(Sbs2Common::getRootAppPath() + QString("vertface_brain_reduced.obj")); sourceRecOn = 0; dragX = dragY = 0; gyroX = gyroY = 0; dragging = 0; logoPixmap.load(":/dtu.jpg"); infoPressed = 0; resetFreqs(); changeFrequency("alpha"); headMovementOn = 1; zeroRotation = 1; infoText = "looking for device..."; devicePresent = 0; dataFlowing = 0; }
void GameControlWidget::initializeGL(){ std::cout<<"gl version:"<<glGetString(GL_VERSION)<<std::endl; qglClearColor(Qt::black); glShadeModel(GL_FLAT); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); glEnable(GL_TEXTURE_2D); glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_COLOR_ARRAY); setAutoBufferSwap(true); glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_REPLACE); //damn Floors::initTexture(); Players::initTexture(); Stars::initTexture(); EndPoints::initTexture(); Backgorund::initTexture(); //start idle func after 600ms QTimer::singleShot(600, this, SLOT(startIdleFunc())); }
GLWindow::GLWindow(int tileIndex) { tileIndex_ = tileIndex; // disable automatic buffer swapping setAutoBufferSwap(false); }
DisplayWidget::DisplayWidget(QWidget *parent,bool FullScreen) :QGLWidget(QGLFormat(QGL::DoubleBuffer|QGL::AlphaChannel|QGL::SampleBuffers|QGL::AccumBuffer), parent, 0, FullScreen?Qt::X11BypassWindowManagerHint:Qt::Widget) { //Take care of window and input initialization. timer.start(16, this); //Draw again shortly after constructor finishes if(FullScreen) { setWindowState(Qt::WindowFullScreen); setCursor(QCursor(Qt::BlankCursor)); //Hide the cursor raise(); //Make sure it's the top window } setPalette(QPalette(QColor(0, 0, 0))); //IF the background draws, draw it black. setAutoFillBackground(false); //Try to let glClear work... setAutoBufferSwap(false); //Don't let QT swap automatically, we want to control timing. backgroundColor=point(0,0,0); deepBackgroundColor=point(0,0,0); for(int k=0;k<4;k++) drawShapes[k]=false; calibrationMode=true; //Set up a "calibration" field. Should be a 1/4 circle in each corner Sphere sphere; spheres.clear(); sphere.color=point(1,0,0); sphere.position=point(0,0,HANDLEDEPTH); sphere.radius=.018; spheres.push_back(sphere); sphere.color=point(0,1,0); sphere.position=point(LEFTPROBE,0,HANDLEDEPTH); spheres.push_back(sphere); sphere.color=point(0,0,1); sphere.position=point(0, UPPROBE,HANDLEDEPTH); spheres.push_back(sphere); }
GLWidget::GLWidget(QWidget *parent) : QGLWidget(parent) { setFocusPolicy(Qt::StrongFocus); //measureFPS = false; //frames = 0; setAutoBufferSwap(true); timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(repaint())); timer->start(1); /* QThread* somethread = new Qthread(this); QTimer* tim = new QTimer(0); //parent must be null tim->setInterval(1); tim->moveToThread(somethread); //connect what you want somethread->start(); QMetaObject::invokeMethod(highPerformanceTimer, "timer_start", Qt::QueuedConnection); */ //FPSTimer = new QTimer(this); //connect(FPSTimer, SIGNAL(timeout()), this, SLOT(changeFPS())); //FPSTimer->start(1000); }
void NavyPainter::initializeGL() { setAutoBufferSwap(false); glClearColor (0, 0, 0, 0); glGenTextures (1, &texture); if (load_texture ("alpha.jpg", alpha_texture, GL_ALPHA, 256) != 0 || load_texture ("reflection.jpg", caustic_texture, GL_RGB, 256) != 0) return; for (int i = 0; i < 256 * 256; i++) { total_texture[4 * i] = caustic_texture[3 * i]; total_texture[4 * i + 1] = caustic_texture[3 * i + 1]; total_texture[4 * i + 2] = caustic_texture[3 * i + 2]; total_texture[4 * i + 3] = alpha_texture[i]; } glBindTexture (GL_TEXTURE_2D, texture); gluBuild2DMipmaps (GL_TEXTURE_2D, GL_RGBA, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, total_texture); glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); glTexGeni (GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); glTexGeni (GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); }
RendererWidget::RendererWidget(QWidget *parent) : QGLWidget(parent) { setMinimumSize(100,100); setAutoBufferSwap(false); doneCurrent(); }
GLWidget::GLWidget(QWidget *parent) : QGLWidget(parent), glt(this) { setAutoBufferSwap(false); resize(320, 240); }
CanvasQt::CanvasQt(QGLParent* parent, uvec2 dim) : QGLWindow(sharedFormat_, parent, sharedGLContext_) , CanvasGL(dim) , swapBuffersAllowed_(false) #ifndef QT_NO_GESTURES , gestureMode_(false) , lastType_(Qt::CustomGesture) , lastNumFingers_(0) , screenPositionNormalized_(vec2(0.f)) #endif { //This is our default rendering context //Initialized once. So "THE" first object of this class will not have any shared context (or widget) //But Following objects, will share the context of initial object if (!sharedGLContext_) { sharedFormat_ = this->format(); sharedGLContext_ = this; sharedCanvas_ = this; QGLWindow::glInit(); } setAutoBufferSwap(false); setFocusPolicy(Qt::StrongFocus); #ifndef QT_NO_GESTURES grabGesture(Qt::PanGesture); grabGesture(Qt::PinchGesture); #endif }
OpenSGWidget::OpenSGWidget(const QGLFormat &f, QWidget *parent) : QGLWidget(f, parent) { setAutoBufferSwap(false); mgr = new SimpleSceneManager; pwin = PassiveWindow::create(); mgr->setWindow(pwin); }
void CGLWidget::paintGL() { if(!mGLThread->running()) { setAutoBufferSwap(false); this->doneCurrent(); mGLThread->start(); } }
video_output_qt_widget::video_output_qt_widget( video_output_qt *vo, const QGLFormat &format, QWidget *parent) : QGLWidget(format, parent), _vo(vo), _gl_thread(vo, this), _width(0), _height(0), _pos_x(0), _pos_y(0) { setAutoBufferSwap(false); setFocusPolicy(Qt::StrongFocus); connect(&_timer, SIGNAL(timeout()), this, SLOT(check_gl_thread())); }
GLWidget::GLWidget(QWidget *parent) : QGLWidget(parent){ setAutoBufferSwap(false); QObject::connect( &timer, SIGNAL(timeout()), this, SLOT(updateGL())); timer.start(33); isAxisDrawn = false; drawWithTexture = false; drawGraph = true; }
TGLWindow::TGLWindow(TSharedPtr <TWorld> &World) : QGLWidget() { world = World; timer = new QTimer(this); connect(&*timer, SIGNAL(timeout()), this, SLOT(onTimer())); timer->start(1000); setAutoBufferSwap(true); }
void GLCanvas::initializeGL() { Application::getInstance()->initializeGL(); setAttribute(Qt::WA_AcceptTouchEvents); setAcceptDrops(true); connect(Application::getInstance(), SIGNAL(applicationStateChanged(Qt::ApplicationState)), this, SLOT(activeChanged(Qt::ApplicationState))); connect(&_frameTimer, SIGNAL(timeout()), this, SLOT(throttleRender())); // Note, we *DO NOT* want Qt to automatically swap buffers for us. This results in the "ringing" bug mentioned in WL#19514 when we're throttling the framerate. setAutoBufferSwap(false); }
OpenSGWidget::OpenSGWidget( QGLFormat f, QWidget *parent, const char *name ) : QGLWidget( f, parent, name ) { setAutoBufferSwap(false); setContext(new OpenSGGLContext(f, this)); mgr = new SimpleSceneManager; pwin = PassiveWindow::create(); mgr->setWindow(pwin); }
View::View(QWidget *parent) : QGLWidget(parent) { setCameraDefaultValue(); m_increment = 0.0; // View needs all mouse move events, not just mouse drag events setMouseTracking(true); // Hide the cursor since this is a fullscreen app setCursor(Qt::BlankCursor); // Particles init setAutoBufferSwap(false); // The tracks related variable setting up position_counter=0; position_counter_camera = 0; track_counter =0; globalcounter = 0; for(int i=0; i<200; i++){ Bcurve::computeBezier4points(camera_points,Vector3(0,0,-10),Vector3(-10,0,0),Vector3(-10,0,0),Vector3(0,0,m_camera.zoom),(float)i/200.0); //Bcurve::computeBezier4points(m_points,Vector3(30,0,0),Vector3(-10,20,0),Vector3(-10,-40,0),Vector3(30,0,0),(float)i/200.0); //cout<<points.size()<<endl; //Bcurve::computeBezier4points(camera_points,Vector3(0,0,0),Vector3(-10,10,0),Vector3(-10,10,0),Vector3(0,0,20),(float)i/200.0); } // View needs keyboard focus setFocusPolicy(Qt::StrongFocus); // The game loop is implemented using a timer connect(&timer, SIGNAL(timeout()), this, SLOT(tick())); // Comet Init drawComet = false; CometPos.x = 40; CometPos.y = 30; CometPos.z = -0; // flag for key bumpmapping = true; stop = false; m_camera_random_track = false; m_follow_comet = false; collision = false; drawline = false; flag_resetParticleCube = false; m_font=QFont(); }
SceneView::SceneView(QWidget * parent, QGLWidget * shareWidget) : QGLWidget(parent, shareWidget), m_effect(NULL), m_scene(NULL), m_wireframe(false), m_ortho(false), renderingIsPaused(false) { sceneBackgroundColor = QColor(0, 0, 0); setAutoBufferSwap(false); }
MyGLWidget::MyGLWidget(QWidget *parent) : QGLWidget(parent) { setAttribute(Qt::WA_PaintOnScreen); setAttribute(Qt::WA_NoSystemBackground); setAutoBufferSwap(false); #ifndef Q_WS_QWS setMinimumSize(300, 250); #endif }
GLWindow::GLWindow(const QRectF& normalizedCoordinates, const QRect& windowRect, QGLWidget* shareWidget) : QGLWidget(0, shareWidget) , backgroundColor_(Qt::black) , normalizedCoordinates_(normalizedCoordinates) { setGeometry(windowRect); setCursor(Qt::BlankCursor); if(shareWidget && !isSharing()) throw std::runtime_error("failed to share OpenGL context"); setAutoBufferSwap(false); }
QGLFrame::QGLFrame(QWidget *parent) : QGLWidget(parent), RenderThread(this) { xRot = 0; yRot = 0; zRot = 0; setAutoBufferSwap(false); QTimer *myTimer = new QTimer; connect(myTimer,SIGNAL(timeout()),SLOT(animate())); myTimer->start(10); initRenderThread(); }
// Select a face void GLWidget::select(const int x, const int y) { // Fill all the faces setFillRenderMode(); setAutoBufferSwap(false); GLC_uint SelectionID= _glc_view.renderAndSelect(x, y); setAutoBufferSwap(true); if (SelectionID != 0) { GLC_3DViewInstance instance(*_glc_world.collection()->instanceHandle(SelectionID)); if (!instance.isEmpty()) { if (instance.geomAt(0)->firstMaterial()->ambientColor() == Qt::gray) { instance.geomAt(0)->firstMaterial()->setAmbientColor(Qt::red); instance.geomAt(0)->firstMaterial()->setDiffuseColor(QColor::fromRgbF(0.8, 0.2, 0.2, 1.0)); } else { instance.geomAt(0)->firstMaterial()->setAmbientColor(Qt::gray); instance.geomAt(0)->firstMaterial()->setDiffuseColor(Qt::gray); } } } else // unselect all the faces { QList<GLC_3DViewInstance*> instansesList = _glc_world.collection()->instancesHandle(); QList<GLC_3DViewInstance*>::iterator facesIter; for (facesIter = instansesList.begin(); facesIter != instansesList.end(); ++facesIter) { (*facesIter)->geomAt(0)->firstMaterial()->setAmbientColor(Qt::gray); (*facesIter)->geomAt(0)->firstMaterial()->setDiffuseColor(Qt::gray); } } updateGL(); }