Hello everyone,

I start learning Qt for scholar work, not without pains
My goal is to pass a QLinearGradient to opengl texture.

Here is my issue : when I try to paint into image a gradient with alpha channel i get a strange render.
The code where I render gradient to image :
Qt Code:
  1. QImage painter_image( 256 , 1 , QImage::Format_ARGB32);
  2. QPainter painter( &painter_image );
  3. painter.setPen(Qt::NoPen);
  4. painter.setBrush( *gradient ); // the gradient came form gradient editor see picture
  5. painter.drawRect( painter_image.rect() );
  6. painter.end();
  7.  
  8. QImage gradient_image = QGLWidget::convertToGLFormat( painter_image );
  9. // use this image to render with opengl ....
  10. // later in code :
  11. glTexImage1D( GL_TEXTURE_1D, 0, GL_RGBA8 , 256 ,0 ,GL_RGBA, GL_UNSIGNED_BYTE, gradient_image.bits() );
To copy to clipboard, switch view to plain text mode 
2 pictures to show up what going wrong :
this one all it's ok because alpha is 255 to all gradient.
ok.jpg
when I change the alpha of blue gradient composante some artefacts appear ( verticals lines with random color ).
bad.jpg
Like you can see, when gradient is paint in the gradient widget the alpha channel is good.
I check image colors RGBA values with
Qt Code:
  1. qDebug()<<qRed( image.pixel( x,0 ) )....
To copy to clipboard, switch view to plain text mode 
to ensure that effect dont came from opengl Render. Artefact appear in both gradient_image and painter_image.
If someone has an idea ...