Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: ARGB to RGBA or another method?  (Read 2156 times)

0 Members and 1 Guest are viewing this topic.

Elgan

  • Jr. Member
  • **
  • Posts: 77
    • AOL Instant Messenger - Flat+1,+17+st+Cl
    • View Profile
ARGB to RGBA or another method?
« 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?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
ARGB to RGBA or another method?
« Reply #1 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.
Laurent Gomila - SFML developer

Elgan

  • Jr. Member
  • **
  • Posts: 77
    • AOL Instant Messenger - Flat+1,+17+st+Cl
    • View Profile
ARGB to RGBA or another method?
« Reply #2 on: December 23, 2011, 07:13:26 pm »
:(

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

anyone have any experience ?