Hi all!

This is my first message in this list. Maybe this question has been asked 
before several times
but I've not been able to find a link with an answer, then I go to the source :)

I'm trying to embed a WebGL page render in my OpenGL application. I've develop 
a little test case
using Qt 5.3.2, when I'm able to show a static html page rendered in a OpenGL 
texture in a QGLWidget.
This texture comes from a QGLFramebufferObject. I use the QWebPage 
'repaintRequested' signal to
do the FBO generation. This is the code:

QGLFramebufferObject *mp_fbo;
QWebPage *mp_Page;
QPainter m_Painter;

void TGSWebNavigator::onRepaintRequested(const QRect& _rect)
{
        ...
        // Paint the view in the FBO.
        m_Painter.begin( mp_fbo );
        mp_Page->mainFrame()->render( &m_Painter, _rect );
        m_Painter.end();

        // Repaint QGLWidget with the new FBO.
}

If I try to do the same with an URL pointing to a WebGL I get OpenGL errors. 
The problem I think is related
to OpenGL contexts because the OpenGL widget has his own context and the WebGL 
rendering is done
is another one. In a static html page no new context is created when rendering 
is done. I've set several
traces to show the current context:

        qDebug() << "[TGSWebNavigator] onRepaintRequested 1... ctx" << 
QGLContext::currentContext();
        m_Painter.begin( mp_fbo );
        qDebug() << "[TGSWebNavigator] onRepaintRequested 2... ctx" << 
QGLContext::currentContext();
        mp_Page->mainFrame()->render( &m_Painter, _rect );
        qDebug() << "[TGSWebNavigator] onRepaintRequested 3... ctx" << 
QGLContext::currentContext();
        m_Painter.end();
        qDebug() << "[TGSWebNavigator] onRepaintRequested 4... ctx" << 
QGLContext::currentContext();

When I start seeing different context in trace 2 and 3, the OpenGL errors 
begins.

I've tried using 'QGLPixelBuffer' because you can set a shared widget which you 
want to share textures
(my QGLWidget) with no luck. The only solution comes from replace the FBO with 
a QImage, render
on it and finally change the texture I use in the QGLWidget with the contents 
from the QImage but this
it's not an option, the perfomance is very affected.

Then my question is: are there any options? Can I set the context where the 
WebGL rendering is done?
Or, at least make it share with a given context? Maybe I'm totally wrong and 
there is other ways to do
what I'm trying to do... Any comment, link, info is welcome!

Best regards,
Jorge

Este mensaje se dirige exclusivamente a su destinatario y puede contener 
información privilegiada o CONFIDENCIAL. Si no es vd. el destinatario indicado, 
queda notificado de que la utilización, divulgación y/o copia sin autorización 
está prohibida en virtud de la legislación vigente. Si ha recibido este mensaje 
por error, le rogamos que nos lo comunique inmediatamente por esta misma vía y 
proceda a su destrucción.

This message is intended exclusively for its addressee and may contain 
information that is CONFIDENTIAL and protected by professional privilege.
If you are not the intended recipient you are hereby notified that any 
dissemination, copy or disclosure of this communication is strictly prohibited 
by law. If this message has been received in error, please immediately notify 
us via e-mail and delete it.
_______________________________________________
webkit-qt mailing list
webkit-qt@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-qt

Reply via email to