Introduction to Modern OpenGL with Python

There are already a lot of sources about Modern OpenGL. But I'm gonna keep going on it as basically. Probably, this post doesn't seem like really scientific stuff. Why I prefer Python for this. Because it's just simple and We have to learn a lot of things for a short period. A programming language is just a tool, well it's for just learning something.

I'm gonna use Pygame which Python's module. Pygame will be an interface that we will communicate with OpenGL. 

We need to OpenGL. Let's install it:

pip install PyOpenGL
So I typed code that below:
import pygame
from OpenGL.GL import *

display = pygame.display.set_mode((800, 600), pygame.DOUBLEBUF|pygame.OPENGL)
clock = pygame.time.Clock()
FPS = 60

while True:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
    glClearColor(1.0, 0.6, 0.0, 1.0)

And that's result what we got:

That's good. There are a few different additions in the basic example of pygame. I'm not going deep into OpenGL in this post. But I will strive to be simple and understandable in the next posts that include this series.

No comments:

Post a Comment