PDA

View Full Version : glDrawArrays gives vertical lines when using GL_POINTS



ShadowAtNight
02-19-2014, 01:41 AM
I'm drawing a points using glDrawArrays with GL_POINTS. On my Intel 82945G Express Chipset Family everything is working fine. But on ATI Radeon Mobility 5730 vertical lines appear randomly when resizing the window.
Here is the code that renders the picture:
glMatrixMode(GL_MODELVIEW);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glColorPointer(color_p_v,GL_FLOAT,offset,color_arr ay);
glDrawArrays(GL_POINTS,0,N);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
I have omitted the array initialization here.
I have checked with gDEBugger that lines are rendered into back buffer after the glDrawArraysfunction is executed.
I saw similar questions here but people are having similar problems when rendering a texture. My case is a bit simpler.
Also there are advice not to use GL_POINTS but this sounds strange to me.
I want to understand what is going on under the hood.
IMHO there is band implementation in particular driver but what is really going on?

PS:
The lines appear at the certain width of the window. When they appear i'm covering the window with other windows(causing the WM_PAINT message and window rerender). The lines still there
​I'm using PFD_DOUBLEBUFFER to enable double buffering.

Dark Photon
02-19-2014, 03:11 PM
I see you enabling the vertex array, but then not calling glVertexPointer(). Seems like a problem...

Also, is "color_p_v" a number of components for the color vertex attribute, is "offset" really a "stride" not an offset (0 for "tightly packed"), and is "color_array" a CPU pointer to the start of the vertex color array?

ShadowAtNight
02-28-2014, 02:28 AM
Dark Photon thanks for reply.
It seems that i have solved the problem. The reason was that i was specifying the coordinates in a way: (x,y).
When i have changed to (x+0.5,y+0.5) everything is fine.

I have heard about that issue. The pixels are lying between integer values. And it seems that different drivers differently round the coordinates. But i'm not sure.
Does anyone know the good article on that issue.