I don't know what these "virtual pixels" you describe are.
While you can define your own coordinate system for
the purpose of exposition,
A pixel doesn't have a position. How many times do I have to
keep saying this?
A pixel is an area, a subset of R^2 containing an infinite number of
points, each of which has a distinct position.
On Wed, 16 Sep 2015 15:56:38 +0200, R.Wieser wrote:term
As I said before: a pixel isn't a point, it's a rectangle. A pixel....
doesn't have a single, specific location.
The centre of the bottom-left pixel is at (0.5,0.5) in window
coordinates.
Thank you for that explanation. It also indicates a problem when the
of"pixel" is used, as lthe ast time you metioned "rectangular pixels" I assumed, from the context, that you ment OpenGLs virtual ones, instead
thethe screens physical ones.
I don't know what these "virtual pixels" you describe are.
But a question: If I would use the exact same explanation, but define
rangingorigin of the screen as the center* of the top-left pixel, with it
itfrom -1/2 pixel to +1/2 pixel, would that make the explanation invalid ?
If so, why ? If not ....
OpenGL defines a number of coordinate systems. Coordinates passed to
OpenGL are interpreted in the coordinate systems which it defines. While
you can define your own coordinate system for the purpose of exposition,
I really don't seen any point; it would just create confusion, as you'd continually need to clarify whether you were talking about your coordinate system or OpenGL's.
* The position of a lamp (or most any single-point lightsource) is
normally defined as its center, not somewhere on its outside. Why would
itsbe different for a pixel ?
A pixel doesn't have a position. How many times do I have to keep saying this?
A pixel is an area, a subset of R^2 containing an infinite number of
points, each of which has a distinct position.
is that in the case where two polygons share a common edge, any pixel
along that edge will belong to exactly one of the two polygons.
I think you've here mentioned the reason why a quad drawn ontop of a lineloop (ofcourse using the same coordinates for both) does not fully overlap the lineloop: because its *forced* to stop one pixel short of
one.left/bottom end-coordinates, so it will not overlap an eventual next
A good choice, but not mentioned anywhere and as such not expected. :-\
The omission of the endpoint is a separate issue, but has a similar origin (certain operations not modifying a pixel multiple times).
The fact that a rasterised line between two points is neither wholly
inside nor wholly outside a rasterised polygon containing that edge is related to the fact that the same edge can be shared by two different polygons (one on each side).
Which polygon should the line be inside or outside? The answer can't be
"the one I'm actually drawing" because drawing operations are independent; the rasterisation of a line can't change based upon whether or not you
also draw a polygon using the same vertices.
2. The reason for using the pixel's centre is that it is unbiased.
Using any other location would result in rasterised polygons exhibiting
a net shift whose magnitude depends upon the raster resolution.
Ehrmmm ... Although I think I understand what problem you are indicating here, wasn't the problem not that OpenGL is *not* using the pixels
center ?
No. Your problem is that rasterisation (for both lines and polygons) is
based upon pixel centers, whose window coordinates are always an integer-plus-a-half, not integers.
for which the line intersects a diamond inscribed within the pixel
Yeah, I found that diamond too. Though I have to say that I do not
quite see how it, in a basic Ortho projection, would affect a
single-pixel width line drawn from the center of a physical pixel to the center of another physical pixel
It doesn't. If you draw between pixel centres, you don't have a problem.
If you draw between pixel corners (i.e. use integer window coordinates),
the problem occurs.
because unless x is a power of two, x*(1/x) typically won't be exactly
1.0 when using floating-point arithmetic.
And thats *exactly* why an OpenGL pixel should *not* be placed, when
using a basic ortho projection and integer coordinates, on the border of two physical ones.
Pixels aren't "placed" anywhere; they're areas, not points (I'm starting
to sound like a stuck gramophone here).
unless you've managed to construct a case where you're consistently
hitting the discontinuity in the rounding function.
Yeah, funny that: I'm using the *most basic* of setups (ortho projection matching the viewport size, integer coordinates for any used vertex),
Which is exactly what you SHOULDN'T be doing. Integer coordinates
correspond to the edges and corners of pixels, i.e. the points exactly between pixels. Which are the worst points to use if you're trying to draw lines such that specific pixels are affected.
If you want to render filled polygons, then integer coordinates are ideal (i.e. they ensure that the edges don't fall on pixel centres, resulting in the inside-ness test being a tie which is decided by rounding error).
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 439 |
Nodes: | 16 (2 / 14) |
Uptime: | 252:46:35 |
Calls: | 9,147 |
Files: | 13,433 |
Messages: | 6,040,938 |