On Tue, 19 Apr 2005 22:23:29 -0400 Jay Summet <[EMAIL PROTECTED]> babbled:
(B
(B> -----BEGIN PGP SIGNED MESSAGE-----
(B>
(B> imlib2 appears to store image data internally in ARGB format, which you can
(B> get
(B> a pointer to with a call such as:
(B> unsigned int *pImageData = imlib_image_get_data();
(B
(Btake a look at:
(Bevas/src/lib/engines/gl_common/evas_gl_texture.c
(B
(Bevas uses the same pix format as imlib2 - and that converts the image to a
(Btexture :) (handles nv_rect extensions, power of 2 padding etc.)
(B
(Bie without alpha:
(BglTexImage2D(GL_TEXTURE_2D, 0,
(B GL_RGB8, w, h, 0,
(B GL_BGRA, GL_UNSIGNED_BYTE, pixels);
(B
(Bwith alpha:
(BglTexImage2D(GL_TEXTURE_2D, 0,
(B GL_RGBA8, w, h, 0,
(B GL_BGRA, GL_UNSIGNED_BYTE, pixels);
(B
(Bcheck that code to see it handling power of 2 problems "properly" (it doesnt
(Bhandle texture meshes when max text size < image size though). it requires no
(Bcopy/transform before copying the pixels to the texture.
(B
(B> OpenGL glTexImage2D() function wants data in RGBA format.
(B>
(B> You can do a manual conversion of each and every pixel with a double for loop
(B> enclosing the following:
(B>
(B> ~ GLdata[offset] = (pImageData[img_offset] >> 16) & 0xff;
(B> ~ GLdata[offset + 1] = (pImageData[img_offset] >> 8) & 0xff;
(B> ~ GLdata[offset + 2] = pImageData[img_offset] & 0xff;
(B> ~ GLdata[offset + 3] = (pImageData[img_offset] >> 24) & 0xff;
(B>
(B> But this is slow.
(B>
(B> Is there a better (faster) way to convert an imlib2 image to an OpenGL
(B> texture?
(B>
(B> Thanks,
(B> Jay
(B>
(B> I'm basically looking to load lots of images in various formats and render
(B> them
(B> as OpenGL textures, I don't think I'll need all of imlib2's image
(B> compositing/blending functionality, so perhaps another library would be a
(B> better
(B> choice? Suggestions?
(B> -----BEGIN PGP SIGNATURE-----
(B> Version: GnuPG v1.2.4 (GNU/Linux)
(B> Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
(B>
(B> iQCVAwUBQmW9IbWkkhmZq4xxAQG/gwP8Cmcz1WmyVuk/qe7OhuPv6yvXFIlrXL4I
(B> 0TMKN3mSvbgQSNC4jYqChlYs6onB01QUjfSYkmxu58M8vw4Ux7fWsaAMcCDeNILm
(B> lubaj3qtTg/PLuiV8dONqgNA6O0yIefZOjktLz4Uc9fzUF6atng+Drq7PTBzHIhT
(B> JU/zCqLLIpQ=
(B> =iqD6
(B> -----END PGP SIGNATURE-----
(B>
(B>
(B> -------------------------------------------------------
(B> This SF.Net email is sponsored by: New Crystal Reports XI.
(B> Version 11 adds new functionality designed to reduce time involved in
(B> creating, integrating, and deploying reporting solutions. Free runtime info,
(B> new features, or free trial, at: http://www.businessobjects.com/devxi/728
(B> _______________________________________________
(B> enlightenment-devel mailing list
(B> [email protected]
(B> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
(B>
(B
(B
(B--
(B------------- Codito, ergo sum - "I code, therefore I am" --------------
(BThe Rasterman (Carsten Haitzler) [EMAIL PROTECTED]
$BMg9%B?(B [EMAIL PROTECTED]
(BTokyo, Japan ($BEl5~(B $BF|K\(B)
(B
(B
(B-------------------------------------------------------
(BThis SF.Net email is sponsored by: New Crystal Reports XI.
(BVersion 11 adds new functionality designed to reduce time involved in
(Bcreating, integrating, and deploying reporting solutions. Free runtime info,
(Bnew features, or free trial, at: http://www.businessobjects.com/devxi/728
(B_______________________________________________
(Benlightenment-devel mailing list
([email protected]
(Bhttps://lists.sourceforge.net/lists/listinfo/enlightenment-devel