void Seed::populate(History &history){ this->history = &history; this->history->setPresent(); setTraversal(); setSurfaceShape(); setSurfaceType(); setMedium(); setLightType(); }
OpenGLWindow::OpenGLWindow(QWindow *parent) : QWindow(parent) , m_update_pending(false) , m_animating(false) , m_context(0) , m_device(0) { setSurfaceType(QWindow::OpenGLSurface); }
Renderer::Renderer(QWindow *parent) : QWindow(parent), context(0), backBuffer(0), frameBuffer(0), shader(0), samples(1), reset(false) { setSurfaceType(QWindow::OpenGLSurface); setFormat(QSurfaceFormat()); create(); mapFileName = "map"; mainFileName = "blank"; }
DrapeSurface::DrapeSurface() : m_dragState(false) , m_contextFactory(NULL) { setSurfaceType(QSurface::OpenGLSurface); QObject::connect(this, SIGNAL(heightChanged(int)), this, SLOT(sizeChanged(int))); QObject::connect(this, SIGNAL(widthChanged(int)), this, SLOT(sizeChanged(int))); }
GlWindow::GlWindow(const QSurfaceFormat& format, QOpenGLContext* shareContext) { setSurfaceType(QSurface::OpenGLSurface); setFormat(format); _context = new QOpenGLContext; _context->setFormat(format); if (shareContext) { _context->setShareContext(shareContext); } _context->create(); }
GLWindow::GLWindow(QWindow *parent): QWindow(parent), update_pending(false), animating(false), glcontext(0), device(0), logger(0) { setSurfaceType(QWindow::OpenGLSurface); }
GLWindow(Qt::WindowFlags flags) : gl(0) { setFlags(flags); setSurfaceType(OpenGLSurface); QSurfaceFormat format; format.setAlphaBufferSize(8); format.setSamples(16); setFormat(format); }
OpenGLWindow::OpenGLWindow() { setSurfaceType(QSurface::OpenGLSurface); container = QWidget::createWindowContainer(this); /////////////////////////////////////////////////////////////////////////// // Window Properties container->setMaximumWidth(Engine::Window->resolution.x); container->setFixedHeight(Engine::Window->resolution.y); Qt2Glfw::Init(); }
QTestWindow() { setSurfaceType(QSurface::OpenGLSurface); QSurfaceFormat format; // Qt Quick may need a depth and stencil buffer. Always make sure these are available. format.setDepthBufferSize(16); format.setStencilBufferSize(8); format.setVersion(4, 5); format.setProfile(QSurfaceFormat::OpenGLContextProfile::CompatibilityProfile); format.setOption(QSurfaceFormat::DebugContext); setFormat(format); _context = new QOpenGLContext; _context->setFormat(format); _context->create(); show(); makeCurrent(); gpu::Context::init<gpu::GLBackend>(); { QOpenGLDebugLogger* logger = new QOpenGLDebugLogger(this); logger->initialize(); // initializes in the current context, i.e. ctx logger->enableMessages(); connect(logger, &QOpenGLDebugLogger::messageLogged, this, [&](const QOpenGLDebugMessage & debugMessage) { qDebug() << debugMessage; }); // logger->startLogging(QOpenGLDebugLogger::SynchronousLogging); } qDebug() << (const char*)glGetString(GL_VERSION); //_textRenderer[0] = TextRenderer::getInstance(SANS_FONT_FAMILY, 12, false); //_textRenderer[1] = TextRenderer::getInstance(SERIF_FONT_FAMILY, 12, false, // TextRenderer::SHADOW_EFFECT); //_textRenderer[2] = TextRenderer::getInstance(MONO_FONT_FAMILY, 48, -1, // false, TextRenderer::OUTLINE_EFFECT); //_textRenderer[3] = TextRenderer::getInstance(INCONSOLATA_FONT_FAMILY, 24); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glClearColor(0.2f, 0.2f, 0.2f, 1); glDisable(GL_DEPTH_TEST); makeCurrent(); setFramePosition(QPoint(-1000, 0)); resize(QSize(800, 600)); }
OpenGLWindow::OpenGLWindow(QWindow *parent) : QWindow(parent) , m_update_pending(false) , m_animating(false) , m_context(0) , m_device(0) , m_program(0) , m_frame(0) , oldMousePosition(-1, -1) { // the window is to be used for OpenGL rendering setSurfaceType(QWindow::OpenGLSurface); }
TestWindow() : focusInEventCount(0) , focusOutEventCount(0) , keyPressEventCount(0) , keyReleaseEventCount(0) , mousePressEventCount(0) , mouseReleaseEventCount(0) , keyCode(0) { setSurfaceType(QSurface::RasterSurface); setGeometry(0, 0, 32, 32); create(); }
HelloWindow::HelloWindow(const QSharedPointer<Renderer> &renderer) : m_colorIndex(0), m_renderer(renderer) { setSurfaceType(QWindow::OpenGLSurface); setFlags(Qt::Window | Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint); setGeometry(QRect(10, 10, 640, 480)); setFormat(renderer->format()); create(); updateColor(); }
QWidgetWindow::QWidgetWindow(QWidget *widget) : QWindow(*new QWidgetWindowPrivate(), 0) , m_widget(widget) { updateObjectName(); // Enable QOpenGLWidget/QQuickWidget children if the platform plugin supports it, // and the application developer has not explicitly disabled it. if (QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::RasterGLSurface) && !QApplication::testAttribute(Qt::AA_ForceRasterWidgets)) { setSurfaceType(QSurface::RasterGLSurface); } connect(m_widget, &QObject::objectNameChanged, this, &QWidgetWindow::updateObjectName); connect(this, SIGNAL(screenChanged(QScreen*)), this, SLOT(repaintWindow())); }
ConnectionWindow::ConnectionWindow(QWidget *parent) : QWidget(parent), ui(new Ui::ConnectionWindow), m_connected(false), m_rfbClient(0), m_pollServerThread(0), m_surfaceWidget(0), m_lookUpId(-1), m_surfaceType(globalConfig->preferencesSurfaceType()) { ui->setupUi(this); if ( m_nextConnectionNumber == 0 ) { if ( QVNCVIEWER_ARG_RASTER ) setSurfaceType(QVNCVIEWER_ARG_RASTER); if ( QVNCVIEWER_ARG_OPENGL ) setSurfaceType(QVNCVIEWER_ARG_OPENGL); } this->setLayout(&mLayout); layout()->setContentsMargins(0, 0, 0, 0); switch ( surfaceType() ) { case QVNCVIEWER_SURFACE_RASTER: default: m_surfaceWidget = new SurfaceWidget(this, this); layout()->addWidget(surfaceWidget()); break; } layout()->setSpacing(0); // configuration menu switch ( surfaceType() ) { case QVNCVIEWER_SURFACE_RASTER: default: surfaceWidget()->setShowFps(globalConfig->preferencesShowFps()); break; } m_currentEncoding = globalConfig->preferencesEncoding(); }
MyGLWidget::MyGLWidget(QWindow *parent) : QWindow(parent), fRotationX(0.0f), fRotationY(0.0f), fRotationZ(0.0f), fMoveUpDown(0.0f), fMoveLeftRight(0.0f), fMoveInOut(0.0f) , m_update_pending(false) , m_animating(false) , m_context(0) , m_device(0) { setSurfaceType(QWindow::OpenGLSurface); }
yage::GLWindow::GLWindow(QScreen *screen) : QWindow(screen) , m_context(0) { // Tell Qt we will use OpenGL for this window setSurfaceType( OpenGLSurface ); QSurfaceFormat format; format.setDepthBufferSize( 24 ); format.setMajorVersion( 3 ); format.setMinorVersion( 2 ); format.setSamples( 4 ); format.setProfile( QSurfaceFormat::CoreProfile ); setFormat( format ); }
QT_BEGIN_NAMESPACE QShapedPixmapWindow::QShapedPixmapWindow() : QWindow(), m_backingStore(0) { QSurfaceFormat format; format.setAlphaBufferSize(8); setFormat(format); setSurfaceType(RasterSurface); setFlags(Qt::ToolTip | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint | Qt::WindowTransparentForInput); create(); m_backingStore = new QBackingStore(this); }
/** * @brief Constructeur paramétré * * Permet d'initialiser la fenêtre et les propriétés de la zone de rendu OpenGL * * @param screen Propriétés de l'écran */ Window::Window(QScreen *screen) : QWindow(screen), m_scene(new MovingColoredTriangle(this)) { // On définit le type de la zone de rendu, dans notre cas il // s'agit d'une zone OpenGL setSurfaceType(QSurface::OpenGLSurface); // Puis on définit les propriétés de la zone de rendu QSurfaceFormat format; format.setDepthBufferSize(24); format.setMajorVersion(4); format.setMinorVersion(3); format.setSamples(4); // Multisampling x4 format.setProfile(QSurfaceFormat::CoreProfile); // Fonctions obsolètes d'OpenGL non disponibles format.setOption(QSurfaceFormat::DebugContext); // On applique le format et on créer la fenêtre setFormat(format); create(); resize(800, 600); setTitle("OpenGLSBExamplesQt - MovingColoredTriangle"); // On créer le contexte OpenGL et on définit son format m_context = new QOpenGLContext; m_context->setFormat(format); m_context->create(); m_context->makeCurrent(this); // On définit le contexte OpenGL de la scène m_scene->setContext(m_context); m_timer.start(); initializeGL(); connect(this, SIGNAL(widthChanged(int)), this, SLOT(resizeGL())); connect(this, SIGNAL(heightChanged(int)), this, SLOT(resizeGL())); resizeGL(); // Création d'un timer permettant la mise à jour de la zone de rendu 60 fois par seconde QTimer* timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(updateScene())); timer->start(16); // f = 1 / 16.10e-3 = 60Hz }
Window::Window(QScreen *screen) : QWindow(screen) { setSurfaceType(QSurface::OpenGLSurface); resize(1024, 768); QSurfaceFormat format; if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL) { format.setVersion(4, 3); format.setProfile(QSurfaceFormat::CoreProfile); } format.setDepthBufferSize(24); format.setSamples(4); setFormat(format); create(); }
CanvasQt::CanvasQt(QGLParent* parent, uvec2 dim) : QGLWindow(parent) , CanvasGL(dim) , thisGLContext_(nullptr) , swapBuffersAllowed_(false) #ifndef QT_NO_GESTURES , gestureMode_(false) , lastNumFingers_(0) , screenPositionNormalized_(vec2(0.f)) #endif { setSurfaceType(QWindow::OpenGLSurface); setFormat(sharedFormat_); create(); thisGLContext_ = new QOpenGLContext(this); thisGLContext_->setFormat(sharedFormat_); //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 bool contextCreated; if (!sharedGLContext_) { contextCreated = thisGLContext_->create(); sharedFormat_ = thisGLContext_->format(); sharedGLContext_ = thisGLContext_; sharedCanvas_ = this; activate(); initializeGL(); } else{ thisGLContext_->setShareContext(sharedGLContext_); contextCreated = thisGLContext_->create(); } if (!contextCreated) { std::cout << "OpenGL context was not created successfully!" << std::endl; int major = sharedFormat_.majorVersion(); int minor = sharedFormat_.minorVersion(); std::cout << "GL Version: " << major << "." << minor << std::endl; std::cout << "GL Profile: " << (sharedFormat_.profile() == QSurfaceFormat::CoreProfile ? "Core" : "CompatibilityProfile") << std::endl; const GLubyte* vendor = glGetString(GL_VENDOR); std::string vendorStr = std::string((vendor!=nullptr ? reinterpret_cast<const char*>(vendor) : "INVALID")); std::cout << "GL Vendor: " << vendorStr << std::endl; } }
MainWindow::MainWindow(QWindow *parent) : QWindow(parent) , updatePending(false) , animating(false) , context(0) , device(0) , inputDevice(this) { setSurfaceType(QWindow::OpenGLSurface); //THERE CAN ONLY BE ONE //.... despite the fact that that's generally bad programming practices. Oh well. Q_ASSERT(!App); App = this; }
MyWindow::MyWindow() : currentTimeMs(0), currentTimeS(0) { mProgram = 0; setSurfaceType(QWindow::OpenGLSurface); setFlags(Qt::Window | Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint); QSurfaceFormat format; format.setDepthBufferSize(24); format.setMajorVersion(4); format.setMinorVersion(3); format.setSamples(4); format.setProfile(QSurfaceFormat::CoreProfile); setFormat(format); create(); resize(800, 600); mContext = new QOpenGLContext(this); mContext->setFormat(format); mContext->create(); mContext->makeCurrent( this ); mFuncs = mContext->versionFunctions<QOpenGLFunctions_4_3_Core>(); if ( !mFuncs ) { qWarning( "Could not obtain OpenGL versions object" ); exit( 1 ); } if (mFuncs->initializeOpenGLFunctions() == GL_FALSE) { qWarning( "Could not initialize core open GL functions" ); exit( 1 ); } initializeOpenGLFunctions(); QTimer *repaintTimer = new QTimer(this); connect(repaintTimer, &QTimer::timeout, this, &MyWindow::render); repaintTimer->start(1000/60); QTimer *elapsedTimer = new QTimer(this); connect(elapsedTimer, &QTimer::timeout, this, &MyWindow::modCurTime); elapsedTimer->start(1); }
WindowQt::WindowQt(const QSurfaceFormat & format) : m_context(new QOpenGLContext) , m_updatePending(false) , m_initialized(false) { QSurfaceFormat f(format); f.setRenderableType(QSurfaceFormat::OpenGL); setSurfaceType(OpenGLSurface); create(); m_context->setFormat(format); if (!m_context->create()) { qDebug() << "Could not create OpenGL context."; QApplication::quit(); } }
QTestWindow() { setSurfaceType(QSurface::OpenGLSurface); QSurfaceFormat format; // Qt Quick may need a depth and stencil buffer. Always make sure these are available. format.setDepthBufferSize(16); format.setStencilBufferSize(8); format.setVersion(4, 3); format.setProfile(QSurfaceFormat::OpenGLContextProfile::CoreProfile); format.setOption(QSurfaceFormat::DebugContext); format.setSwapInterval(0); setFormat(format); _qGlContext.setFormat(format); _qGlContext.create(); show(); makeCurrent(); setupDebugLogger(this); gpu::Context::init<gpu::GLBackend>(); _context = std::make_shared<gpu::Context>(); auto shader = makeShader(unlit_vert, unlit_frag, gpu::Shader::BindingSet{}); auto state = std::make_shared<gpu::State>(); state->setMultisampleEnable(true); state->setDepthTest(gpu::State::DepthTest { true }); _pipeline = gpu::Pipeline::create(shader, state); // Clear screen gpu::Batch batch; batch.clearColorFramebuffer(gpu::Framebuffer::BUFFER_COLORS, { 1.0, 0.0, 0.5, 1.0 }); _context->render(batch); DependencyManager::set<GeometryCache>(); DependencyManager::set<DeferredLightingEffect>(); resize(QSize(800, 600)); _time.start(); }
DrapeSurface::DrapeSurface() : m_dragState(false) , m_navigator(m_scales) , m_contextFactory(NULL) { setSurfaceType(QSurface::OpenGLSurface); QObject::connect(this, SIGNAL(heightChanged(int)), this, SLOT(sizeChanged(int))); QObject::connect(this, SIGNAL(widthChanged(int)), this, SLOT(sizeChanged(int))); ///{ Temporary initialization m_model.InitClassificator(); // Platform::FilesList maps; // Platform & pl = GetPlatform(); // pl.GetFilesByExt(pl.WritableDir(), DATA_FILE_EXTENSION, maps); // for_each(maps.begin(), maps.end(), bind(&model::FeaturesFetcher::RegisterMap, &m_model, _1)); // ///} // /// }
OpenGLWindow::OpenGLWindow( QWindow *parent ) : QWindow( parent ), d( new Private(this) ) { setSurfaceType( QWindow::OpenGLSurface ); QSurfaceFormat format; //format.setDepthBufferSize( 24 ); //format.setSamples( 4 ); //format.setMajorVersion( 3 ); //format.setMinorVersion( 3 ); format.setSwapBehavior( QSurfaceFormat::DoubleBuffer ); format.setRenderableType( QSurfaceFormat::OpenGL ); format.setProfile( QSurfaceFormat::CompatibilityProfile ); setFormat( format ); create(); d->thread = OpenGLRenderThread::instance(); d->renderId = d->thread->registerSurface( this ); d->thread->update( d->renderId ); }
PaintedWindow::PaintedWindow() { QSurfaceFormat format; format.setStencilBufferSize(8); format.setSamples(4); setSurfaceType(QWindow::OpenGLSurface); setFlags(Qt::Window | Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint); setFormat(format); create(); m_context = new QOpenGLContext(this); m_context->setFormat(format); m_context->create(); m_animation = new QPropertyAnimation(this, "rotation"); m_animation->setStartValue(qreal(0)); m_animation->setEndValue(qreal(1)); m_animation->setDuration(500); QRect screenGeometry = screen()->availableGeometry(); QPoint center = screenGeometry.center(); QRect windowRect = screen()->isLandscape(screen()->orientation()) ? QRect(0, 0, 640, 480) : QRect(0, 0, 480, 640); setGeometry(QRect(center - windowRect.center(), windowRect.size())); m_rotation = 0; reportContentOrientationChange(screen()->orientation()); m_targetOrientation = contentOrientation(); m_nextTargetOrientation = Qt::PrimaryOrientation; connect(screen(), &QScreen::orientationChanged, this, &PaintedWindow::orientationChanged); connect(m_animation, &QAbstractAnimation::finished, this, &PaintedWindow::rotationDone); typedef void (PaintedWindow::*PaintedWindowVoidSlot)(); connect(this, &PaintedWindow::rotationChanged, this, static_cast<PaintedWindowVoidSlot>(&PaintedWindow::paint)); }
QOpenGLTextureBlitWindow::QOpenGLTextureBlitWindow() : QWindow() , m_context(new QOpenGLContext(this)) { resize(500,500); setSurfaceType(OpenGLSurface); QSurfaceFormat surfaceFormat = format(); if (QCoreApplication::arguments().contains(QStringLiteral("-coreprofile"))) { surfaceFormat.setVersion(3,2); surfaceFormat.setProfile(QSurfaceFormat::CoreProfile); } setFormat(surfaceFormat); create(); m_context->setFormat(surfaceFormat); m_context->create(); m_context->makeCurrent(this); m_blitter.create(); qDebug("GL_TEXTURE_EXTERNAL_OES support: %d", m_blitter.supportsExternalOESTarget()); }
QTestWindow() { setSurfaceType(QSurface::OpenGLSurface); QSurfaceFormat format; // Qt Quick may need a depth and stencil buffer. Always make sure these are available. format.setDepthBufferSize(16); format.setStencilBufferSize(8); setGLFormatVersion(format); format.setProfile(QSurfaceFormat::OpenGLContextProfile::CoreProfile); format.setOption(QSurfaceFormat::DebugContext); setFormat(format); _context.setFormat(format); _context.create(); show(); makeCurrent(); gpu::Context::init<gpu::gl::GLBackend>(); qDebug() << (const char*)glGetString(GL_VERSION); //_textRenderer[0] = TextRenderer::getInstance(SANS_FONT_FAMILY, 12, false); //_textRenderer[1] = TextRenderer::getInstance(SERIF_FONT_FAMILY, 12, false, // TextRenderer::SHADOW_EFFECT); //_textRenderer[2] = TextRenderer::getInstance(MONO_FONT_FAMILY, 48, -1, // false, TextRenderer::OUTLINE_EFFECT); //_textRenderer[3] = TextRenderer::getInstance(INCONSOLATA_FONT_FAMILY, 24); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glClearColor(0.2f, 0.2f, 0.2f, 1); glDisable(GL_DEPTH_TEST); makeCurrent(); resize(QSize(800, 600)); }
QtOpenGLWindowBase::QtOpenGLWindowBase(const QSurfaceFormat & format) : m_context(new QOpenGLContext) , m_initialized(false) , m_updatePending(false) { QSurfaceFormat f(format); f.setRenderableType(QSurfaceFormat::OpenGL); setSurfaceType(OpenGLSurface); create(); if (f.version().first < 3) { m_context->setFormat(f); if (!m_context->create()) { qDebug() << "Could not create intermediate OpenGL context."; QApplication::quit(); } else { QSurfaceFormat intermediateFormat = m_context->format(); qDebug().nospace() << "Created intermediate OpenGL context " << intermediateFormat.version().first << "." << intermediateFormat.version().second; if ((intermediateFormat.version().first == 3 && intermediateFormat.version().second == 0) || intermediateFormat.version().first < 3) { f.setMajorVersion(3); f.setMinorVersion(2); f.setProfile(QSurfaceFormat::CoreProfile); } } } m_context->setFormat(f); if (!m_context->create()) { qDebug() << "Could not create OpenGL context."; QApplication::quit(); } else { qDebug().nospace() << "Created OpenGL context " << m_context->format().version().first << "." << m_context->format().version().second; } }