GL_POINTS_SMOOTH cause strange TRIANGLE_STRIP

Hello folks. I’ve run into one problem which I can’t fully understand. First a snapshot of my code:

//enable states
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindVertexArray(crosshairLineVAO);
glEnable(GL_LINE_SMOOTH);
glLineWidth(4.0f);
glDrawArrays(GL_LINES, 0, 6);
glDisable(GL_LINE_SMOOTH);
glBindVertexArray(crosshairEndVAO);
glEnable(GL_POINT_SMOOTH);
glPointSize(10.0f);
glDrawArrays(GL_POINTS, 0, 3);
glDisable(GL_POINT_SMOOTH);
glBindVertexArray(0);
glDisable(GL_BLEND);

///use this to correct error
glBegin(GL_POINTS);
glVertex3f(0,20,0);
glEnd();
///

//disable states
glDepthMask(GL_FALSE);
glDisable(GL_DEPTH_TEST);

Here I render a crosshair for my camera. Everything is really fine if you use this code and all subsequent rendering is correct. So the result of it all looks like this (note that crosshair is under surface and only Y axis is visible):

You can clearly see the white square point I rendered separately. Now that’s the problem because it’s just some dummy point which is there only to render my surface correctly. What happens if I remove it is this:

The surface renders this way every second render call, so it actually blinks between good and bad version.

What I believe is the problem whit:

glDisable(GL_POINT_SMOOTH);

When I don’t apply smoothing at all, the surface renders correctly, if I enable it the surface makes this strange thing, but why when it should be disabled whit disabling the state? It looks like that glDisable is applied only when next point is rendered.

Well and the second question is why this even happens. My surface is rendered as triangle strip through shader and without rendering that crosshair everything works correctly so it must be definitely error in this piece of code. What are these strange shapes that renders instead of triangles? it’s like one side and some curve over it - like smoothing was applied to one point of that triangle…

Hi,
Could u try removing the depth masks

glDepthMask(GL_TRUE); ...glDepthMask(GL_FALSE);

call and see if you still get these artefacts.

As I’m using that pair 3 times in my code (clearing, rendering crosshair, rendering surface), I’ve first tried to comment it out only when rendering crosshair, then in all 3 cases but the artifacts persist (note that I also commented out that code for rendering dummy point).

Hmm, could u just check the OpenGL error bit I suspect there might be something wrong elsewhere. Call this at the top of the render function once.

assert(glGetError()==GL_NO_ERROR);

Tell us if you get an assertion?

I use this piece of code to query for errors:


#define printGLError();{ \
	GLenum glErr = glGetError(); \
	while (glErr != GL_NO_ERROR){ \
		std::cout	<< "glError " << glErr << " file: " << __FILE__ << " @ " << __LINE__ \
					<< "	" << gluErrorString(glErr) << std::endl << std::endl; \
		glErr = glGetError();\
	}\
}

I’ve put printGLError() on first and last line of rendering section but neither one prints out an error.

Edit: Just for sure I tried also assert instead printGLError() and no assertion happened.