[Development] Texture image loading library

Giuseppe D'Angelo giuseppe.dangelo at kdab.com
Mon Jan 23 11:33:23 CET 2017


Il 21/01/2017 15:02, Иван Комиссаров ha scritto:
> Do I understand correctly that all is needed is to scan header of the
> texture, get some info from it and than load whole texture to the byte
> array?

Yes, get some metadata from the file, and no, not necessarily extract
the images as byte arrays.

It would actually be a total waste to copy it in CPU memory if you can
avoid that. The ideal and easy path would be getting a QOpenGLTexture
out of such a file with 0 CPU copies (e.g.: mmap the file, upload into
texture).

> It may be reasonable to create separate libraries that handle specific
> textures (dds, etc1, …).

I don't see the point at this stage, nor what advantage it would bring
to the user if she has to identify the file format first, and then use a
specific loader. (Side note: DDS is a file format, ETC1 is a compression
format. We want to parse/load data from the file, not decode or
decompress such data.)

> For now, I see some duplication of the code - there are similar
> structures in qt3d/src/threed/textures/qgltextureutils.cpp and
> qtimageformats/src/plugins/imageformats/dds/ddsheader.h, for example.

Yes, the one in qt3d should be extracted and reused, alongside with the
KTX format reader. The one in qtimageformats is currently dead.

Cheers,
-- 
Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Senior Software Engineer
KDAB (UK) Ltd., a KDAB Group company | Tel: UK +44-1625-809908
KDAB - Qt, C++ and OpenGL Experts

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4007 bytes
Desc: Firma crittografica S/MIME
URL: <http://lists.qt-project.org/pipermail/development/attachments/20170123/b7de24a5/attachment.bin>


More information about the Development mailing list