Skip to content

Instantly share code, notes, and snippets.

@8Observer8
Created November 12, 2025 18:22
Show Gist options
  • Select an option

  • Save 8Observer8/81dc4cea56969e4015cb5807aff38d12 to your computer and use it in GitHub Desktop.

Select an option

Save 8Observer8/81dc4cea56969e4015cb5807aff38d12 to your computer and use it in GitHub Desktop.
Background color using OpenGL, Pygame, and Python
# pip install PyOpenGL Pygame
import pygame
from OpenGL.GL import *
from pygame.locals import *
def main():
pygame.init()
pygame.display.set_mode((350, 350), DOUBLEBUF | OPENGL)
pygame.display.set_caption("PyOpenGL, Pygame, Python")
glClearColor(0.2, 0.2, 0.2, 1)
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
glClear(GL_COLOR_BUFFER_BIT)
pygame.display.flip()
pygame.time.wait(10)
pygame.quit()
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment