Skip to content

Commit d578f69

Browse files
committed
Only support 3.3+ core forward compat contexts
Due to ModernGL it doesn't make sense to make this configurable any more.
1 parent 5ce7b57 commit d578f69

File tree

4 files changed

+25
-58
lines changed

4 files changed

+25
-58
lines changed

demosys/conf/default_settings.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@
3232
# forward_compat: Whether we should drop fixed pipeline and only support core
3333
OPENGL = {
3434
"version": (3, 3),
35-
"profile": "core",
36-
"forward_compat": True,
3735
}
3836

3937
# Window size

demosys/context/glfw.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@
88

99
from .base import Context
1010

11-
PROFILES = {
12-
'any': glfw.OPENGL_ANY_PROFILE,
13-
'core': glfw.OPENGL_CORE_PROFILE,
14-
'compat': glfw.OPENGL_COMPAT_PROFILE,
15-
}
16-
1711

1812
class GLTFWindow(Context):
1913
min_glfw_version = (3, 2, 1)
@@ -35,13 +29,9 @@ def __init__(self):
3529
glfw.window_hint(glfw.CONTEXT_VERSION_MAJOR, settings.OPENGL['version'][0])
3630
glfw.window_hint(glfw.CONTEXT_VERSION_MINOR, settings.OPENGL['version'][1])
3731

38-
profile = PROFILES.get(settings.OPENGL['profile'])
39-
if not profile:
40-
raise ImproperlyConfigured("OPENGL profile {} not supported".format(profile))
41-
4232
glfw.window_hint(glfw.OPENGL_PROFILE, glfw.OPENGL_CORE_PROFILE)
43-
if settings.OPENGL.get('forward_compat'):
44-
glfw.window_hint(glfw.OPENGL_FORWARD_COMPAT, True)
33+
glfw.window_hint(glfw.OPENGL_FORWARD_COMPAT, True)
34+
4535
if not settings.WINDOW.get('resizable'):
4636
glfw.window_hint(glfw.RESIZABLE, False)
4737

demosys/view/controller.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
Thins needs to be improved once more pieces fall in place.
44
"""
55
import glfw
6+
7+
# We still use PyOpenGL for samplers and don't want it to halt on errors
68
import OpenGL
9+
OpenGL.ERROR_CHECKING = False
710

811
from demosys import context, resources
912
from demosys.conf import settings
@@ -15,9 +18,6 @@
1518

1619
from . import screenshot
1720

18-
# We still use PyOpenGL for samplers and don't want it to halt on errors
19-
OpenGL.ERROR_CHECKING = False
20-
2121
TIMER = None
2222
CAMERA = None
2323
MANAGER = None

docs/source/settings.rst

Lines changed: 20 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,56 +2,35 @@
22
Settings
33
========
44

5-
65
The ``settings.py`` file must be present in your project containing settings
76
for the project.
87

98
When running your project with ``manage.py``, the script will set
109
the ``DEMOSYS_SETTINGS_MODULE`` environment variable. This tells
1110
the framework where it can import the project settings. If the environment
12-
variable is not set the project cannot start.
11+
variable is not set, the project cannot start.
1312

1413
OPENGL
15-
^^^^^^
16-
17-
.. Warning:: We cannot guarantee the framework will work properly for non-default values.
18-
We strongly discourage enabling backwards compatibility.
19-
It might of curse make sense in some cases if you bring in existing draw
20-
code from older projects. Be extra careful when using deprecated OpenGL states.
21-
Mixing in `PyOpenGL` is also not recommended.
14+
------
2215

23-
Using default values we can be more confident that cross-platform support is
24-
upheld. Remember that some platforms/drivers such as on OS X, core profiles
25-
can only be forward compatible or the context creation will simply fail.
16+
Sets the minimum required OpenGL version to run your project.
17+
A forward compatible core context will be always be created. This means
18+
the system will pick the highest available OpenGL version available.
2619

27-
The default OpenGL version is 3.3 to support a wider range of hardware.
20+
The default and lowest OpenGL version is 3.3 to support a wider
21+
range of hardware.
22+
To make your project work on OS X you cannot move past version 4.1 (sadly).
2823

2924
.. code:: python
3025
3126
OPENGL = {
3227
"version": (3, 3),
33-
"profile": "core",
34-
"forward_compat": True,
3528
}
3629
37-
- ``version`` describes the major and minor version of the OpenGL context we
38-
are creating
39-
- ``profile`` should ideally always be ``core``, but we leave it configurable
40-
for those who might want to include legacy OpenGL code permanently or
41-
temporary. Do note that not using core profile will exclude the project
42-
from working on certain setups and may have unexpected side effects.
43-
44-
- ``any``: glfw.OPENGL_ANY_PROFILE,
45-
- ``core``: glfw.OPENGL_CORE_PROFILE,
46-
- ``compat``: glfw.OPENGL_COMPAT_PROFILE,
47-
48-
- ``forward_compat`` True, is required for the project to work on OS X and
49-
platforms only supporting forward compatibility.
50-
51-
.. Note:: To make your project work on OS X you cannot move past version 4.1 (sadly).
30+
Only increase the OpenGL version if you use features above 3.3.
5231

5332
WINDOW
54-
^^^^^^
33+
------
5534

5635
Window/screen properties. If you are using Retina or 4k displays, be aware that
5736
these values can refer to the virtual size. The actual buffer size will be
@@ -92,7 +71,7 @@ The created window frame buffer will by default use:
9271
- color and depth buffer is cleared for every frame
9372

9473
MUSIC
95-
^^^^^
74+
-----
9675

9776
The ``MUSIC`` attribute is used by timers supporting audio playback.
9877
When using a timer not requiring an audio file, the value is ignored.
@@ -107,7 +86,7 @@ Should contain a string with the absolute path to the audio file.
10786
MUSIC = os.path.join(PROJECT_DIR, 'resources/music/tg2035.mp3')
10887
10988
TIMER
110-
^^^^^
89+
-----
11190

11291
This is the timer class that controls time in your project.
11392
This defaults to ``demosys.timers.Timer`` that is simply keeps
@@ -129,7 +108,7 @@ Other timers are:
129108
More information can be found in the :doc:`/guides/timers` section.
130109

131110
ROCKET
132-
^^^^^^
111+
------
133112

134113
Configuration of the pyrocket_ sync-tracker library.
135114

@@ -155,7 +134,7 @@ Configuration of the pyrocket_ sync-tracker library.
155134
}
156135
157136
EFFECTS
158-
^^^^^^^
137+
-------
159138

160139
Effect packages that will be recognized by the project.
161140
Initialization should happens in the order they appear in the list.
@@ -167,7 +146,7 @@ Initialization should happens in the order they appear in the list.
167146
)
168147
169148
EFFECT_MANAGER
170-
^^^^^^^^^^^^^^
149+
--------------
171150

172151
Effect mangers are pluggable classed that initialize and run effects.
173152
When only having a single effect we can run it using ``runeffect``,
@@ -185,7 +164,7 @@ If we use the ``run`` sub-command, the first registered effect will run.
185164
More info in the :doc:`guides/effectmanagers` section.
186165

187166
SHADER_STRICT_VALIDATION
188-
^^^^^^^^^^^^^^^^^^^^^^^^
167+
------------------------
189168

190169
Boolean value. If ``True`` shaders will raise ``ShaderError`` when
191170
setting uniforms variables that don't exist.
@@ -197,7 +176,7 @@ missing or incorrect uniforms. Other times you want to know in a more
197176
brutal way that something is wrong.
198177

199178
SHADER_DIRS/FINDERS
200-
^^^^^^^^^^^^^^^^^^^
179+
-------------------
201180

202181
``SHADER_DIRS`` contains absolute paths the ``FileSystemFinder`` will
203182
look for shaders.
@@ -220,7 +199,7 @@ your effect package.
220199
)
221200
222201
TEXTURE_DIRS/FINDERS
223-
^^^^^^^^^^^^^^^^^^^^
202+
--------------------
224203

225204
Same principle as ``SHADER_DIRS`` and ``SHADER_FINDERS``.
226205
The ``EffectDirectoriesFinder`` will look for a ``textures`` directory in effects.
@@ -239,7 +218,7 @@ The ``EffectDirectoriesFinder`` will look for a ``textures`` directory in effect
239218
)
240219
241220
SCENE_DIRS/FINDERS
242-
^^^^^^^^^^^^^^^^^^
221+
------------------
243222

244223
Same principle as ``SHADER_DIRS`` and ``SHADER_FINDERS``.
245224
This is where scene files such as wavefront and gltf files are loaded from.
@@ -260,7 +239,7 @@ The ``EffectDirectoriesFinder`` will look for a ``scenes`` directory
260239
261240
262241
SCREENSHOT_PATH
263-
^^^^^^^^^^^^^^^
242+
---------------
264243

265244
Absolute path to the directory screenshots will be saved.
266245
If not defined or the directory don't exist it will be created.

0 commit comments

Comments
 (0)