'How to use GL_POINTS and MSAA in OpenGL

I'm a Newbie in OpenGl. I try to draw points with Pyglet. But if I change the configs of the window, to enable MSAA, the points disappear. For other primitives this is not the case. I think this is a OpenGL problem and not caused by Pyglet. My goal is to use MSAA (for getting smooth lines) or config2 in example code and also see the points.

Please see the example code and switch between the different configs.

import pyglet
from pyglet.gl import *

config1 = Config(sample_buffers=1, samples=4)
config2 = Config(sample_buffers=1, samples=4, double_buffer=True)

window = pyglet.window.Window()                         # everything there, but no smooth line
# window = pyglet.window.Window(config = config1)       # draws nothing
# window = pyglet.window.Window(config = config2)       # draws only smooth line, points missing

batch = pyglet.graphics.Batch()

line = batch.add(2, pyglet.gl.GL_LINES, None, ('v2f', (270, 165, 370, 315)))
point = batch.add(2, pyglet.gl.GL_POINTS, None, ('v2f', (300, 165, 400, 315)))

@window.event
def on_draw():
    window.clear()
    batch.draw()
    
pyglet.app.run()

It's a problem with MSAA but I don't really understand why my Points disappear. Any fixes/explanations?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source