On Tue, 19 Apr 2005 22:23:29 -0400 Jay Summet <[EMAIL PROTECTED]> babbled:
> -----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();
take a look at:
evas/src/lib/engines/gl_common/evas_gl_texture.c
evas uses the same pix format as imlib2 - and that converts the image to a
texture :) (handles nv_rect extensions, power of 2 padding etc.)
ie without alpha:
glTexImage2D(GL_TEXTURE_2D, 0,
GL_RGB8, w, h, 0,
GL_BGRA, GL_UNSIGNED_BYTE, pixels);
with alpha:
glTexImage2D(GL_TEXTURE_2D, 0,
GL_RGBA8, w, h, 0,
GL_BGRA, GL_UNSIGNED_BYTE, pixels);
check that code to see it handling power of 2 problems "properly" (it doesnt
handle texture meshes when max text size < image size though). it requires no
copy/transform before copying the pixels to the texture.
> 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
>
--
------------- Codito, ergo sum - "I code, therefore I am" --------------
The Rasterman (Carsten Haitzler) [EMAIL PROTECTED]
裸好多 [EMAIL PROTECTED]
Tokyo, Japan (東京 日本)
-------------------------------------------------------
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