Having
srf = pygame.display.set_mode(viewport, OPENGL | DOUBLEBUF)
and performing
srf.fill([255,255,255])
results in the following error message:
pygame.error: Cannot call on OPENGL Surfaces
How to solve this issue? How can I change the background color?
You have to use the
glClearColor
function to set the color you want to clear your screen to, and then useglClear
to actually clear the screen with the color specified.E.g. call
to set the color to red and then call
to clear the screen to this color.