Is my computer color blind?
I made a program to select color and converted RGB into HEX for color palette in real time. The color result on color palette showed different than a color I selected on OpenGL window.
I wasn''t sure what was wrong with it. So I tested my painter program from vendor. I zoomed the picture and selected a color. I still get the same result. Is my computer color blind?
Waldoo
Maybe the paint program uses BGR?
Chess is played by three people. Two people play the game; the third provides moral support for the pawns. The object of the game is to kill your opponent by flinging captured pieces at his head. Since the only piece that can be killed is a pawn, the two armies agree to meet in a pawn-infested area (or even a pawn shop) and kill as many pawns as possible in the crossfire. If the game goes on for an hour, one player may legally attempt to gouge out the other player's eyes with his King.
Windows bitmaps are BGR, not RGB...
for example, the following code ripped off form the OpenGL superbible would draw a windows bitmap at the current raster position:
glDrawPixels(width, height, GL_BGR, GL_UNSIGNED_BYTE, BitmapBits);
If for some reason you''re using OpenGL prior to 1.2, the colorspace is called GL_BGR_EXT instead of GL_BGR.
Or you can just switch the B and G bytes when putting them into your palette.
for example, the following code ripped off form the OpenGL superbible would draw a windows bitmap at the current raster position:
glDrawPixels(width, height, GL_BGR, GL_UNSIGNED_BYTE, BitmapBits);
If for some reason you''re using OpenGL prior to 1.2, the colorspace is called GL_BGR_EXT instead of GL_BGR.
Or you can just switch the B and G bytes when putting them into your palette.
I tried your suggestion and it did not work. RGB was more close to accurate color matching. BGR was more like negative color film.
Here is a copy below of color picking function for Visual Basic. I hope you will help solve it.
Waldoo
Private Red As Byte
Private Green As Byte
Private Blue As Byte
Public mousexpos As String
Public mouseypos As String
Option Explicit
Public Function DrawGLScene() As Boolean
glReadPixels mousexpos, mouseypos, 1, 1, rpRed, pxlByte, Red
Form2.Text1(4).Text = Red
glReadPixels mousexpos, mouseypos, 1, 1, rpGreen, pxlByte, Green
Form2.Text1(5).Text = Green
glReadPixels mousexpos, mouseypos, 1, 1, rpBlue, pxlByte, Blue
Form2.Text1(6).Text = Blue
form1.Picture1.BackColor = RGB(Blue, Green, Red)
Here is a copy below of color picking function for Visual Basic. I hope you will help solve it.
Waldoo
Private Red As Byte
Private Green As Byte
Private Blue As Byte
Public mousexpos As String
Public mouseypos As String
Option Explicit
Public Function DrawGLScene() As Boolean
glReadPixels mousexpos, mouseypos, 1, 1, rpRed, pxlByte, Red
Form2.Text1(4).Text = Red
glReadPixels mousexpos, mouseypos, 1, 1, rpGreen, pxlByte, Green
Form2.Text1(5).Text = Green
glReadPixels mousexpos, mouseypos, 1, 1, rpBlue, pxlByte, Blue
Form2.Text1(6).Text = Blue
form1.Picture1.BackColor = RGB(Blue, Green, Red)
I just found what the problem was. glReadPixel was reading pixels the glwindow as it was upside down upon window''s mouse coordinate value as the starting point (0,0) is at top left. It is my guess that glReadPixel''s starting point was bottom left or right.
What would you suggest to fix that?
Waldoo
What would you suggest to fix that?
Waldoo
if it starts at the top left and openGL starts at the bottom left... then all you have to do is subtract the given Y value from the height of your window...
if the height is 200, and windows returns 79... what this really means is that the color being picked is 79 from the top of the window or 121 from the bottom... so 200 - 79 = 121.
Jason
"Wise men talk because they have something to say; fools talk because they have to say something." -Plato
http://www.jasontconnell.com
if the height is 200, and windows returns 79... what this really means is that the color being picked is 79 from the top of the window or 121 from the bottom... so 200 - 79 = 121.
Jason
"Wise men talk because they have something to say; fools talk because they have to say something." -Plato
http://www.jasontconnell.com
"Wise men talk because they have something to say; fools talk because they have to say something." -Platohttp://www.jasontconnell.com
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement