thank you[/b]
I am thinking it is that the origin in OpenGL is 0,0 at lower left whereas many windowing systems have 0,0 at top so you might need to change your line from
If not it, please be more specific about the problem you are having - I can think of several other possibilities depending on the symptoms of the problem.
thank you[/b]
Could be the origin of OpenGL and your windowing system are not the saem (i.e. origin in OpenGL is 0,0 at lower left - some windowing systems have origin at upper left).
Change
c=(3*(BitmapInfo)->bmiHeader.biWidthy )+(x3);
to
c=(3*(BitmapInfo)->bmiHeader.biWidth*(winheight-y) )+(x*3);
where winheight is the height of the viewport or window client area.
Also, verify your type for BitmapBits is char or change the r,g, b vars to type char or coerce the r, g, b values to receive char. Is each RGB component stored as an int or is the RGB value stored in a single int? Or is the data contiguous with each component stored packed together? What kind of values are you getting for each RGB component? 0-255? or 0-4294967296?
we are using 0 - 255
we tried u r code its working fine in newly created bmp files. if converted images its showing wrong value.
for example if image is JPEG converted to BMP file and run the program ,its print wrong RGB value.
This looks to be your converter that make some messes… I don’t know about BMP, but as for many formats, the converter might use some compression, or another way to make them (windows bmp…).
One thing you should look at is the height of the bitmap (from the bitinfoheader or equivalent) - if it is negative then it is top-down, if positive it is bottom-up so you need to use both your original method and the method I provided based on this info.