SFML community forums
Help => Graphics => Topic started by: takercena on March 21, 2012, 07:27:33 am
-
Hello, how do I convert RGB to RGBA pixels for texture initialization?
-
Add A
RGB + A = RGBA
:mrgreen:
If you want a real answer, please ask a real question (with details etc.).
-
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