I am currently programming a game with PyOpenGL with PyGame, and when using Vertex Buffers, graphical glitches occur. The glitches include lines being drawn between each model when it shouldn't. I have found that alternating between Ground() and GroundVBO() does not cause any graphical glitches most of the time. Is there anything that I am missing?
global vbo
vbo = 0
def Ground():
glBegin(GL_LINES)
for edge in ground_edges:
for vertex in edge:
glVertex3fv(ground_verticies[vertex])
glEnd()
def GroundVBO():
for edge in ground_edges:
for vertex in edge:
ground_noot = glVertex3fv(ground_verticies[vertex])
vbo = glGenBuffers(1)
glBindBuffer (GL_ARRAY_BUFFER, vbo)
glBufferData (GL_ARRAY_BUFFER, len(ground_verticies)*4, ground_noot, GL_STATIC_DRAW)
glVertexPointer (3, GL_FLOAT, 0, None)
glDrawArrays(GL_LINES, 0, 300)