I have an application involving rendering of a 2D image with graphical line overlays. In this application, it is essential that proper pixel registration between the image and the overlays is maintained. I’ve done this type of work on other systems in the past and did not expect any surprises; however, I’m seeing behavior that I did not expect. Thought I’d run it by other OpenGL folks and see if this is really a bug with nVidia’s implementation or simply something I’m overlooking. Here goes:
Basically, I’m seeing that the second vertex specified for each line is not being filled. For example, lets say you have a 2D ortho projection set up and you render the following two horizontal lines:
glBegin(GL_LINES);
glVertex2f( (GLfloat) 0.5,
(GLfloat) 0.5 );
glVertex2f{ (GLfloat) 31.5,
(GLfloat) 0.5 );
glEnd();
glBegin(GL_LINES);
glVertex2f( (GLfloat) 63.5,
(GLfloat) 0.5 );
glVertex2f{ (GLfloat) 31.5,
(GLfloat) 0.5 );
glEnd();
Personally, I would expect this to result in one continuous horizontal line of 64 pixels in length. Instead, it results in what appears to be two lines seperated by a single non-filled pixel at the location specified as the second end-point for each of the line rendering directives. Again, vertex ordering is important. If you reversed the vertex ordering within the glBegin() and glEnd() statements, you end up with one solid line missing a pixel at each end instead.
Anyway, just wondering if anyone else had noticed this also? If not, perhaps it’s simply a problem with my code. If so, is this the intended behavior or is this counter to the intended behavior. At this point, I’m leaning toward this being a bug in the OpenGL implementation; however, I’m open to enlightenment as to the error of my ways.
Thanks!