Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 461
  • Last Modified:

glColor3d distorts colors

i have an array:
int pixelmap[500][500][3]
of pixels (it's a picture) and display it this way:

      raudona = (double) pixelmap[i][j][0]/255;
      zhalia = (double) pixelmap[i][j][1]/255;
      melyna = (double) pixelmap[i][j][2]/255;
      glColor3d(raudona, zhalia, melyna);
      glVertex2f(movei-1, movej-1);

the displayed result is http://www.mif.vu.lt/~tost1285/after.jpg
the original file http://www.mif.vu.lt/~tost1285/before.jpg

is there more effective way to display pixelmap array?

p.s. i can't just load a texture - i have to work with an array (not necessary integer)
0
tigrine_smiltpele
Asked:
tigrine_smiltpele
1 Solution
 
sunnycoderCommented:
looks like you are modifying the rgb values before you diplay the picture and then complaining about color distortion .. in this case, you are bound to get some distortion... If you do not want distortions then why not render the picture as it is?  Or may be I am missing a poiint?
0
 
tigrine_smiltpeleAuthor Commented:
i've found a solution myself. the problem was that bitmap is holding colors not rgb, but bgr.
when i switched the colors to  glColor3d(melyna, zhalia, raudona); it worked fine
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now