As far as it is relevant to the current problem:

I want to get RGB values from a 24 bit BGR data. This data is from a raw image without a header.
I don't know how to convert the index of the buffer to its corresponding RGB values.
here is what I have done:

Qt Code:
  1. window_width = 800;
  2.  
  3. window_height = 600;
  4.  
  5. size = window_width * window_height;
  6.  
  7. pixels = new float[size*3];
  8.  
  9. for(int i = 0, j = 0; i < size*3, j < size; i += 3, j++)
  10. {
  11. pixels[i+2] = bytes[i];
  12. }
  13.  
  14. updateGL();
To copy to clipboard, switch view to plain text mode 


void GlWidget:aintGL()
{

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glDrawPixels(window_width,window_height,GL_RGB,GL_ FLOAT,pixels);
}

what am i missing?