PDA

View Full Version : Inability to draw on certain pixels



08-22-2003, 09:10 AM
Hi, I am using opengl to draw to a bitmap using VC++ in a CWND. I have set my view using orthogonal projection w/ parameters set to the size of the bitmap. I have noticed some inconsistancies when plotting lines similar to that of an audio signal. I have tested the plotting by drawing a vertical line from the bottom of the window to the top of the window for every pixel on the screen. The problem I have is that at about 3 quarters of the width of the screen whether I am using single or dual monitors, there are several vertical lines that don't get plotted. Blank lines range from 3 to over 12 and don't seem to be in any pattern. They are not continuous either. I am extremely stumped on why the drawing has been flawless except in this one small region with a width of about 30 pixels. I Any advice on this is appreciated

BlueJ
08-22-2003, 10:50 AM
I had the same problem in orthogonal projection. But the problem only showed up on a Voodoo 3 graphics card, several different Geforce cards all rendered graphics acurately. I never found a solution or explanation. Since then I've been working with a normal projection matrix and haven't noticed any discrepencies.

It is possible that I'm just not seeing it though, a triangle can be rendered across one of these gaps but a vertice cannot appear on these random lines.

cfmdobbie
08-22-2003, 10:57 AM
You could have some rounding artifacts going on. If you're drawing pixel-perfect lines, make sure you're not drawing with integer values, but with floats set to the *middle* of each pixel. Remember that in OpenGL, integer values are *between* pixels.

Instead of glVertex2i(x, y) try glVertex2f(x + 0.5f, y + 0.5f).

Aside from that, no idea. Can you post an obligatory screenshot, just in case it jogs someone's memory?