Solved

glColor3d distorts colors

Posted on 2003-10-25
4
438 Views
Last Modified: 2013-12-06
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
Comment
Question by:tigrine_smiltpele
4 Comments
 
LVL 45

Expert Comment

by:sunnycoder
ID: 9685980
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
 

Accepted Solution

by:
tigrine_smiltpele earned 0 total points
ID: 9686267
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Artificial Intelligence comes in many forms, and for game developers, Path-Finding is an important ability for making an NPC (Non-Playable Character) maneuver through terrain.  A* is a particularly easy way to approach it.  I’ll start with the algor…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now