[Development] Adding 10-bit OpenGL support in QML

Kurt Pattyn pattyn.kurt at gmail.com
Wed Feb 26 18:26:52 CET 2014


Thanks for the reply.

On 25 Feb 2014, at 23:22, Gunnar Sletta <gunnar.sletta at jolla.com> wrote:

> On 26 Feb 2014, at 00:42, Kurt Pattyn <pattyn.kurt at gmail.com> wrote:
> 
>> We are currently looking into a way to render a 10-bit image in QML.
> 
> I'm going to assume we're talking about Qt Quick 2.0.
Yes, indeed.
> 
> As in 10-bit grayscale or GL_UNSIGNED_INT_10_10_10_2?
Yes, both grayscale and color 10-bit.
> In any case, you can create a custom QSGTexture class which defines the format and contents of your texture and display that in the scene graph using a QSGSimpleTextureNode. If something more specific is needed, write your own material to do exactly what you want.
Is it correct that we can subclass a QQuickItem and return a subclassed QSGSimpleTextureNode object from the updatePaintNode() method?
> 
>> Our first idea is to create an OpenGL context in C++ and use that in QML.
> 
> You cannot create the OpenGL context for QQuickWindow, but you can request the format it should take via QQuickWindow::setFormat().
> 
>> QML must be able to overlay text on this 10-bit OpenGL context.
>> 
>> What is the best approach for this? Is it possible at all?
>> Can we expose a QGLWidget, or something similar?
> 
> QQuickWindow has an QOpenGLContext and does not use QGLWidget.
So, as I understand this is what should be done:
QSurfaceFormat surfaceFormat;
surfaceFormat.setRenderableType(QSurfaceFormat::OpenGL);
//set bitDepth on surfaceFormat
QQuickView * view = new QQuickView();
view->setFormat(surfaceFormat);

And then use a subclassed QQuickItem together with a subclassed QSGSimpleTextureNode.

Is this correct?

Cheers,

Kurt
> 
> 
> cheers,
> Gunnar
> 




More information about the Development mailing list