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

Author Topic: RGB image pixels  (Read 1040 times)

0 Members and 1 Guest are viewing this topic.

takercena

  • Newbie
  • *
  • Posts: 10
    • View Profile
RGB image pixels
« on: March 21, 2012, 07:27:33 am »
Hello, how do I convert RGB to RGBA pixels for texture initialization?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
RGB image pixels
« Reply #1 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.).
Laurent Gomila - SFML developer

max_vodoo

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Email
Re: RGB image pixels
« Reply #2 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