SFML community forums

Help => Graphics => Topic started by: takercena on March 21, 2012, 07:27:33 am

Title: RGB image pixels
Post by: takercena on March 21, 2012, 07:27:33 am
Hello, how do I convert RGB to RGBA pixels for texture initialization?
Title: RGB image pixels
Post by: Laurent on March 21, 2012, 07:59:33 am
Add A
Code: [Select]
RGB + A = RGBA
:mrgreen:

If you want a real answer, please ask a real question (with details etc.).
Title: Re: RGB image pixels
Post by: max_vodoo on April 02, 2012, 01:35:45 am
use some thing like this
void  ToRGBA(unsigned char * frame,unsigned char * RGBA,int width,int height)
{
   int count=0;
   int count2=0;
    while(count2<width*height*3)
    {
       RGBA[count]=frame[count2];
       RGBA[count+1]=frame[count2+1];
       RGBA[count+2]=frame[count2+2];
       RGBA[count+3]=255;
       count+=4;
       count2+=3;
      


    }


}
hope that helps