Пример #1
0
void QWindowCompositor::render()
{
    m_window->makeCurrent();

    cleanupGraphicsResources();
    m_backgroundTexture = m_textureCache->bindTexture(QOpenGLContext::currentContext(),m_backgroundImage);

    m_textureBlitter->bind();
    // Draw the background image texture
    m_textureBlitter->drawTexture(m_backgroundTexture,
                                  QRect(QPoint(0, 0), m_backgroundImage.size()),
                                  window()->size(),
                                  0, false, true);

    foreach (QWaylandSurface *surface, m_surfaces) {
        if (!surface->visible())
            continue;
        GLuint texture = composeSurface(surface);
        QRect geo(surface->pos().toPoint(),surface->size());
        m_textureBlitter->drawTexture(texture,geo,m_window->size(),0,false,surface->isYInverted());
    }

    m_textureBlitter->release();
    frameFinished();
    // N.B. Never call glFinish() here as the busylooping with vsync 'feature' of the nvidia binary driver is not desirable.
    m_window->swapBuffers();
}
Пример #2
0
void LipstickCompositor::surfaceDamaged(const QRect &)
{
    if (!isVisible()) {
        // If the compositor is not visible, do not throttle.
        // make it conditional to QT_WAYLAND_COMPOSITOR_NO_THROTTLE?
        frameFinished(0);
    }
}
Пример #3
0
void LipstickCompositor::windowSwapped()
{
#if QT_VERSION >= QT_VERSION_CHECK(5,2,0)
    if (m_fullscreenSurface) {
        sendFrameCallbacks(QList<QWaylandSurface *>() << m_fullscreenSurface);
    } else {
        sendFrameCallbacks(surfaces());
    }
#else
    frameFinished(m_fullscreenSurface);
#endif
}
Пример #4
0
void LipstickCompositor::surfaceDamaged(const QRect &)
{
    if (!isVisible()) {
        // If the compositor is not visible, do not throttle.
        // make it conditional to QT_WAYLAND_COMPOSITOR_NO_THROTTLE?
#if QT_VERSION >= QT_VERSION_CHECK(5,2,0)
        sendFrameCallbacks(surfaces());
#else
        frameFinished(0);
#endif
    }
}
Пример #5
0
QSGNode *EmulatorItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *updatePaintNodeData)
{
	QSGSimpleTextureNode *n = static_cast<QSGSimpleTextureNode *>(oldNode);
	if (!n) {
		m_gl = window()->openglContext()->functions();
		connect(window(), SIGNAL(frameFinished()), this, SLOT(onFrameFinished()));
		n = new QSGSimpleTextureNode();
		QImage img(GFX_WIDTH, GFX_HEIGHT, QImage::Format_RGBA8888);
		m_screen = new GLuint[GFX_WIDTH * GFX_HEIGHT];
		img.fill(Qt::green);
		m_texture = window()->createTextureFromImage(img);
		m_texture->setFiltering(QSGTexture::Linear);
		n->setTexture(m_texture);
		n->setRect(boundingRect());
	}

	m_texture->bind();
	m_gl->glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, GFX_WIDTH - 16, GFX_HEIGHT - 32, 0, GL_RGB, GL_UNSIGNED_BYTE, m_screen);

	return n;
}
Пример #6
0
void XApp::draw() {
    if (ovrRendering) {
        vr.startFrame();
    }
    app->draw();

    // Present the frame, if in VR this was already done by oculus SDK
    if (!ovrRendering) {
        int frameIndex = xapp().getCurrentBackBufferIndex();
        lastPresentedFrame = frameIndex;
        ThrowIfFailedWithDevice(swapChain->Present(0, 0), xapp().device.Get());
    }

    if (ovrRendering) {
        vr.endFrame();
        if (ovrMirror) {
            int frameIndex = xapp().getCurrentBackBufferIndex();
            lastPresentedFrame = frameIndex;
            ThrowIfFailedWithDevice(swapChain->Present(0, 0), xapp().device.Get());
        }
    }
    frameFinished();
}
Пример #7
0
void SystemCompositor::frameSwapped()
{
    frameFinished(m_currentSurface);
}
Пример #8
0
void LipstickCompositor::windowSwapped()
{
    frameFinished(m_fullscreenSurface);
}