PDA

View Full Version : Loss of inofrmations...



El_Segador
07-14-2003, 06:35 PM
I everyone, I continue with my bmp picture saga, it's the third episode, welcome for the newcomers!
Well, let's try to do it short now. I transform bmp picture, but sometimes it appears that there is a lot of loss informations (we can see pixel coming bigger and bigger as the color information go...who know where!).
Well the thing is I use char array to store the pixel color data (one for the red, one for the green and another for the blue). Then, I do my routine and calcule which pixel should replace another, so I say in C++ language originally "You! Pixel of position i/j your values will be replace by those of the pixel from u/v so from the R:00 G:13 B:F2 you will become a R:00 G:36 B:64" ok? I take a pixel values and replace by another...
So where the loss of information can occure? May be the pixel coordinate should be float and no int but what I manipule are char array so I don't care of the "true coordinate of the pixel in my screen" because I got the "pixel value in my array"...
I mean, even if the pixel on my screen is at the x:31.56,y:54.23, this pixel will be store (its value in fact) in an array of int...And do really the pixel coordinate are float?
For exemple from this original picture: http://guildeikeria.free.fr/pictureSrc.bmp
sometimes I get things like this one : http://guildeikeria.free.fr/pictureDest.bmp
Well, may be it's a bit hard to understand me (but it's always hard to understand sagas), and thanks to the ones who will help me (and thanks to the one woh helped me).

[This message has been edited by El_Segador (edited 07-14-2003).]

Relic
07-14-2003, 07:11 PM
Difficult to say without seeing the algorithm.
You do the replacement operation in the same image?
Looks like you're replicating some lines over and over again.
If yes, you need to either do this "double buffered", so image iteration n+1 results are stored in a second image not disturbing the source data, then exchange the image source and destination and so on.
Or if the reads and writes run in a specified direction, you need to choose the order in which you're processing the pixels carefully. Never overwrite data you will source later on.
Or you have some rounding problem where a number of image colors fall into the same color bucket.
If this is a continuos application of glReadPixels, replacement, glDrawPixels for example, make sure the coordinates for the glDrawPixels actually lies on a pixel corner to perfectly hit pixel areas.
If this is drawn with textured quads, what are the filter modes?
Do you happen to run in 16 bpp?
You see, the description really lacks an explanation of what you're actually doing.

[This message has been edited by Relic (edited 07-14-2003).]

El_Segador
07-15-2003, 10:45 PM
I use several array to stock my informations, but I guess the problem come from here (I don't use glDrawPixel etc for the moment, I just recreate bmp, I don't display woth openGL yet), I mean, may be I erase some informations before using them...
I will try to analyse this.
But I realise is not so easy to help, so thanks.