View Full Version : about clanlib texture pixels format .

07-04-2013, 09:52 AM
can I use RGB_565 , ARGB_4444, RGBA_8888, RGBX_8888, RGB_888 texture ?

07-04-2013, 10:50 AM
can I use RGB_565 , ARGB_4444, RGBA_8888, RGBX_8888, RGB_888 texture ?

Sorry, I don't understand half of this words.
But i will try to help.

Why you want to use another texture, if you can create text and etc. right here.
Front, Size, Color. Just Look above.


07-04-2013, 11:04 AM
Sorry ..
I have some image .but pixels format is RGB_565 , ARGB_4444, RGBA_8888, RGBX_8888, RGB_888,

07-06-2013, 05:14 AM
If you're loading from memory using the CL_PixelBuffer interface, you can check the CL_TextureFormat enumerator.

RGB_565 - No. (Interestingly, ClanLib 1.0.0 had an entry for this (http://www.clanlib.org/docs/clanlib-1.0.0/Reference/html/CL_PixelFormat.html))
RGB_888 - Yes, via cl_rgb8.
RGBA_8888 - Yes, via cl_rgba8
RGBX_8888 - No, but you can just use cl_rgba8 and drop/ignore the alpha channel.
ARGB_4444 - No, but we have cl_rgba4 (different colour order) and cl_argb8 (different colour size).

07-11-2013, 05:38 AM
If the image is a raw bitmap inside the system memory, you can construct a PixelBuffer and pass the pointer to that image into it using the proper texture format flag. ClanLib supports RGBA_8888(cl_rgba8) and RGB_888(cl_rgb8), while the others need to be converted manually to work. From there you can create a texture using the newly created PixelBuffer.

In ClanLib 2.3 you can do something like:

CL_PixelBuffer image(width, height, cl_rgba8, raw_data); // Create system pixel buffer from raw_data
CL_Texture texture(clgc, width, height, cl_rgba8); // Create texture with proper dimensions
texture.set_image(image); // Put image data into texture.