title: Can RGB values be negative?
body: <p>I'm trying to draw a picture using <code>glVertex</code>. And here is my code:</p>
  
  <pre><code>struct Pixel{
      GLbyte R, G, B;
  };
  
   GLbyte * originalData = NULL;
  
   . . . 
  
   originalData = (GLbyte *)malloc(IMAGE_SIZE);
   fread(originalData, IMAGE_SIZE, 1, file);
    for (int n = 0; n &lt; 256 * 256; n++){
          pixels[n].R = data[n * 3 + 0];
          pixels[n].G = data[n * 3 + 1];
          pixels[n].B = data[n * 3 + 2];
  
          if (pixels[n].R &lt; (GLbyte)0) std::cerr &lt;&lt; "??" &lt;&lt; std::endl;
      }
  </code></pre>
  
  <p>And the Display Function:</p>
  
  <pre><code>glBegin(GL_POINTS);
  unsigned int i = 0;
  for (unsigned row = 0; row &lt; iWidth; row++){
      for (unsigned col = 0; col &lt; iHeight; col++){
          glColor3b(pixels[i].R, pixels[i].G, pixels[i].B);
          glVertex3f(row,col,0.0f);
          i++;
      }
  }
  glEnd();
  </code></pre>
  
  <p>When I'm using <code>glDrawPixels(256, 256, GL_RGB, GL_UNSIGNED_BYTE, originalData);</code> Everything is OK, but Colors get mixed up when I'm using my method. </p>
  
  <p>Can RGB values be negative? when I use  </p>
  
  <pre><code>glColor3b(abs(pixels[i].R), abs(pixels[i].G), abs(pixels[i].B));
  </code></pre>
  
  <p>my output looks better(but again some colors get mixed up).</p>
  
  <p><strong>NOTE1:</strong> I'm trying to rasterize a <code>.raw</code> file that I created with Photoshop</p>
  
  <p><strong>NOTE2:</strong> I know my method is dummy, but I'm experimenting things</p>