Drawing Points Using Pyglet and OpenGL

suggest change
import pyglet
from pyglet.gl import *

win = pyglet.window.Window()
glClear(GL_COLOR_BUFFER_BIT)

@win.event
def on_draw():
    glBegin(GL_POINTS)
    glVertex2f(x, y) #x is desired distance from left side of window, y is desired distance from bottom of window
    #make as many vertexes as you want
    glEnd

To connect the points, replace GL_POINTS with GL_LINE_LOOP.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents