[Qt-interest] QImage: raw data to RGBA QByteArray (for use with OpenGL)
Alessandro Portale
Alessandro.Portale at trolltech.com
Sun Jul 12 00:49:45 CEST 2009
Does QGLContext::bindTexture() not work for You?
http://doc.qtsoftware.com/latest/qglcontext.html#bindTexture
But answering Your question:
You can get the images raw data with the bits() function...
http://doc.qtsoftware.com/latest/qimage.html#bits-2
...and also the amount needed bytes via numbytes().
http://doc.qtsoftware.com/latest/qimage.html#numBytes
These can be fed into the QByteArray constructor that takes a data
pointer and size information:
http://doc.qtsoftware.com/latest/qbytearray.html#QByteArray-3
Alessandro
noname schrieb:
> hi,
>
> i'm wondering if there's a way to convert a QImage to a QByteArray
> containing the raw image data in RGBA format,
> so i can use it with OpenGL?
>
> thanks in advance!
>
> sincerely,
> julian
More information about the Qt-interest-old
mailing list