SFML community forums

Help => Graphics => Topic started by: Elgan on December 23, 2011, 05:57:01 pm

Title: ARGB to RGBA or another method?
Post by: Elgan on December 23, 2011, 05:57:01 pm
Hello I have a buffer in ARGB format. I am trying to bind it to a texture, sprite for display.


bitmap_in = sourceBuffer    
ARGB buffer with width/height of sourceBufferRect
Code: [Select]



if (!Image.LoadFromPixels(bitmap_rect.width(),bitmap_rect.height(), bitmap_in))
{
    // Error...
}



LoadFromPixels(w, h, PointerToPixelsInMemory);
Please note that when you load an image from memory, pixels must have a specific format, which is 32-bits RGBA.


I think I can bind them to opengl textures, but I don't regally want to do taht.

Is there a way in SF to load, translate the format?

anyone know of a good way, I am struggling to find much conversion information.

Edit: you know I'm sure you can do this at opengl level with parameters...maybe there is a way in SFML to just supply those parameters?

Quote


void glReadPixels(   GLint     x,
    GLint     y,
    GLsizei     width,
    GLsizei     height,
    GLenum     format,
    GLenum     type,
    GLvoid *     data);



though not looked how loadpixel works. I assume it just sets a format?
Title: ARGB to RGBA or another method?
Post by: Laurent on December 23, 2011, 06:27:55 pm
SFML doesn't provide all the options that OpenGL has, you can't use anything else than RGBA to load an image.
Title: ARGB to RGBA or another method?
Post by: Elgan on December 23, 2011, 07:13:26 pm
:(

so I guess ill have to work out a conversion :\

anyone have any experience ?