Have you tried changing your texture data format to use GL_BGRA and/or
GL_UNSIGNED_INT_8_8_8_8_REV? Between them you may be able to set the
texture data without the copy or byte swapping.

On 4/19/05, Jay Summet <[EMAIL PROTECTED]> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> 
> imlib2 appears to store image data internally in ARGB format, which you can 
> get
> a pointer to with a call such as:
> unsigned int *pImageData = imlib_image_get_data();
> 
> OpenGL glTexImage2D() function wants data in RGBA format.
> 
> You can do a manual conversion of each and every pixel with a double for loop
> enclosing the following:
> 
> ~            GLdata[offset]     = (pImageData[img_offset] >> 16) & 0xff;
> ~            GLdata[offset + 1] = (pImageData[img_offset] >> 8) & 0xff;
> ~            GLdata[offset + 2] =  pImageData[img_offset] & 0xff;
> ~            GLdata[offset + 3] = (pImageData[img_offset] >> 24) & 0xff;
> 
> But this is slow.
> 
> Is there a better (faster) way to convert an imlib2 image to an OpenGL 
> texture?
> 
> Thanks,
> Jay
> 
> I'm basically looking to load lots of images in various formats and render 
> them
> as OpenGL textures, I don't think I'll need all of imlib2's image
> compositing/blending functionality, so perhaps another library would be a 
> better
> choice? Suggestions?
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.4 (GNU/Linux)
> Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
> 
> iQCVAwUBQmW9IbWkkhmZq4xxAQG/gwP8Cmcz1WmyVuk/qe7OhuPv6yvXFIlrXL4I
> 0TMKN3mSvbgQSNC4jYqChlYs6onB01QUjfSYkmxu58M8vw4Ux7fWsaAMcCDeNILm
> lubaj3qtTg/PLuiV8dONqgNA6O0yIefZOjktLz4Uc9fzUF6atng+Drq7PTBzHIhT
> JU/zCqLLIpQ=
> =iqD6
> -----END PGP SIGNATURE-----
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by: New Crystal Reports XI.
> Version 11 adds new functionality designed to reduce time involved in
> creating, integrating, and deploying reporting solutions. Free runtime info,
> new features, or free trial, at: http://www.businessobjects.com/devxi/728
> _______________________________________________
> enlightenment-devel mailing list
> enlightenment-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
>


-------------------------------------------------------
This SF.Net email is sponsored by: New Crystal Reports XI.
Version 11 adds new functionality designed to reduce time involved in
creating, integrating, and deploying reporting solutions. Free runtime info,
new features, or free trial, at: http://www.businessobjects.com/devxi/728
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to