/>Фрагмент кода:
Код: Выделить всё
#Import needed packages.
import pygame as pg
import moderngl as mgl
import sys
class GraphicsEngine:
def __init__(self, win_size=(1600, 900)):
#Initialize pygame module.
pg.init()
#Window size
self.WIN_SIZE = win_size
#Set OpenGL attribute.
pg.display.gl_set_attribute(pg.GL_CONTEXT_MAJOR_VERSION, 3)
pg.display.gl_set_attribute(pg.GL_CONTEXT_MINOR_VERSION, 3)
pg.display.gl_set_attribute(pg.GL_CONTEXT_PROFILE_MASK, pg.GL_CONTEXT_PROFILE_CORE)
#Create OpenGL context
pg.display.set_mode(self.WIN_SIZE, flags=pg.OPENGL | pg.DOUBLEBUF)
#Detect and use exisiting OpenGL context.
self.ctx = mgl.create_context()
.............. .................................................. .................................................. .................................................. .................................................. .................................................. .................
Подробнее здесь: https://stackoverflow.com/questions/791 ... ith-opengl