Skip to content

Commit

Permalink
Actually requesting the needed OpenGL version for once
Browse files Browse the repository at this point in the history
- Hope i am getting this stuff right, OpenGL is a mess regarding its versioning
  • Loading branch information
Square789 committed Mar 12, 2023
1 parent b716c1f commit c261708
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 19 deletions.
25 changes: 6 additions & 19 deletions pyday_night_funkin/main_game.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,6 @@
from loguru import logger
import pyglet

# You really want to leave this set to `True` unless you haven't
# touched the rendering backend AND not seen an OpenGL error for at
# least 20 hours on at least three different systems.
# This bool enables/disables pyglet's GL error checking, causing PNF
# to silently drown in errors should something go wrong if this is
# `False`. As it does run some python code each GL call (of which there's
# dozens per frame), it should give some speedup when disabled however.
# pyglet.options["debug_gl"] = True

from pyday_night_funkin.core import ogg_decoder
from pyday_night_funkin.core.asset_system import load_font
from pyday_night_funkin.core.key_handler import KeyHandler, RawKeyHandler
Expand Down Expand Up @@ -163,18 +154,14 @@ def elapsed_patcher(record: "Record") -> None:
resizable = True,
vsync = False,
caption = f"PydayNightFunkin' v{__version__}",
config = pyglet.gl.Config(major_version=4, minor_version=5),
)

# OpenGL context is probably good here,
# initialize and set up a bunch of global stuff.
try:
from pyday_night_funkin.core.graphics.cygl import gl as cygl
except ImportError:
pass
else:
from pyglet.gl import gl
cygl.initialize(gl)
logger.info("cygl module found and initialized.")
# OpenGL context is probably good here, initialize and set up this global horribleness.
from pyday_night_funkin.core.graphics.cygl import gl as cygl
from pyglet.gl import gl
cygl.initialize(gl)
logger.info("cygl module initialized.")

if self.use_debug_pane:
self.debug_pane.init_graphical()
Expand Down
8 changes: 8 additions & 0 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ def main():
"If specified more often than that, will disable debug mode and the debug pane."
),
)

# You really want to keep this defaulting to `True` unless you haven't
# touched the rendering backend AND not seen an OpenGL error for at
# least 20 hours on at least three different systems.
# This bool enables/disables pyglet's GL error checking, causing PNF
# to silently drown in errors should something go wrong if this is
# `False`. As it does run some python code each GL call (of which there's
# dozens per frame), it should give some speedup when disabled however.
argparser.add_argument(
"--no-gl-errcheck",
"-g",
Expand Down

0 comments on commit c261708

Please sign in to comment.