Hello,
I use glOrtho for 2D drawing, and i ve noticed a problem : for example if i draw 4 connected lines that represent a lozenge, that lines are not connected on the screen, but if i draw this shape like a fill polygon, it’s work properly… I work on a nvidia GeForce 3 on Win NT.
Can it be a driver problem, OpenGL implementation ?
Originally posted by patapon: Hello,
I use glOrtho for 2D drawing, and i ve noticed a problem : for example if i draw 4 connected lines that represent a lozenge, that lines are not connected on the screen, but if i draw this shape like a fill polygon, it’s work properly… I work on a nvidia GeForce 3 on Win NT.
Can it be a driver problem, OpenGL implementation ?
There’s another possibility you missed – there could be a problem with your code
GL_LINES draws disjoint lines. (See page 44 of the Red Book, for example).
If you want the lines joined, use GL_LINE_STRIP or GL_LINE_LOOP.
Also, remember the start pixel for subsequent lines in your case is the same as the end pixel for the prev line. Now,if you have various blending things set up you could fall foul of this!
Try making each line a different colour!
Switch off all blending etc.
Just a thought, but I have seen this brought up before …
In my code I use GL_LINE_STRIP, that was just to show a simple example. Also it’s not usual that 2 lines that have a shared point (in particular the first or last point) are disjoint : when you draw a line you give the first & last point, others are interpolated with bresenham, so with my GLORTHO projection, when you call
the firts point must match with the last point of the previous line.
I have try LINE_LOOP, LINE_STRIP, I have try to draw with GL_POLYGON in the mode glPolygonMode(GL_FRONT_AND_BACK,GL_LINE), but in all case line are disjoint !!
If you don’t see what I mean try the example of my previous topic and draw the four line you will see!