Note that there are some explanatory texts on larger screens.

plurals
  1. PORender Image into subclassed QDeclarativeItem using OpenGL
    text
    copied!<p>I am trying to perform several image manipulations using OpenGL ES 2.0 and display the output into a subclassed QDeclarativeItem which will then be used within my QML GUI. I read through the answers found here: <a href="http://developer.qt.nokia.com/forums/viewthread/4109" rel="nofollow">http://developer.qt.nokia.com/forums/viewthread/4109</a> and succeeded in drawing a red-to-blue colored rectangle within my QML GUI by overriding the paint() methode of the QDeclarativeItem:</p> <pre><code>void GLDeclarativeItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { painter-&gt;beginNativePainting(); glBegin(GL_QUADS); glColor3ub(0,0,255); glVertex2d(0, 0); glVertex2d(0, height()); glColor3ub(255,0,0); glVertex2d(width(), height()); glVertex2d(width(), 0); glEnd(); painter-&gt;endNativePainting(); } </code></pre> <p>However, what I am trying to achieve is to draw the image which will be handled within my custom QGLWidget as the content of the above described QDeclarativeItem (instead of the red-to-blue colored content).</p> <p>Within my custom QGLWidget I am using:</p> <pre><code>void GLWidget::paintGL() { glClear(GL_COLOR_BUFFER_BIT); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); } </code></pre> <p>for drawing, which worked fine. However, I can not find the conversion between the drawing within my GLWidget and my GLDeclarativeItem. All the things I have tried so far just gave me a rectangle without any content at all. Thanks for your help!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload