I’m trying to draw grid lines in 2d ortho. proj. where the ortho delta depends on user input value delta.
the line width is 1.0f and all lines are in same color and 1.0f alpha but the lines look weird like some are light and some are dark, some has thickness of 2 pixels and some 1 pixel as shown in screenshot below.
I tried all combinations of enabling and disabling Line and Point smoothing and alpha blending.
I realized it can be because my orthographic delta isn’t scaled with screen delta and my points aren’t actually hitting the actual pixel values in terms of orthographic coordinates.
Try thicker lines if you use line smoothing, something like 1.33 is good. They will all be a bit thicker, but look more consistent.
You cay also try setting glHint to GL_NICEST, though I’ve never seen an implementation that differentiated the slightest between GL_FASTEST and NICEST.
oh well… I choose constant line attributes and it decides to create them in various widths and colors with no api-side correction just because my value range does not cover “discrete raster graphics’” reality range?
what if it’s a scientific project which should be error-free? oh I can see the newsflash on TV after space shuttle accident “Shocking Confession from Engineers: We considered PI as 3. discrete raster graphics…”
btw this is not about you xmas. I’m just tired and angry. many thanks u both for trying to help.
It is called antialiasing. A one pixel wide line at fractional coordinates should not look the same as a one pixel wide line on integer coordinates. You’d be ignoring position information.
Your result looks like you have multisample antialiasing enabled. If you don’t like what you get, you can either disable it or align your lines to the pixel grid.
what if it’s a scientific project which should be error-free? oh I can see the newsflash on TV after space shuttle accident “Shocking Confession from Engineers: We considered PI as 3. discrete raster graphics…”
Mapping a continuous space to a discrete space (pixel raster) won’t be error-free. The result you expect isn’t more “correct” than the result you get at the moment.