Skip to content

Commit 79a7cc4

Browse files
authored
Expose OpenGL extensions (#2379)
1 parent fb28eea commit 79a7cc4

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

arcade/gl/context.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,21 @@ def info(self) -> GLInfo:
311311
"""
312312
return self._info
313313

314+
@property
315+
def extensions(self) -> set[str]:
316+
"""
317+
Get a set of supported OpenGL extensions strings for this context.
318+
319+
This can be used to check if a specific extension is supported::
320+
321+
# Check if bindless textures are supported
322+
"GL_ARB_bindless_texture" in ctx.extensions
323+
# Check for multiple extensions
324+
expected_extensions = {"GL_ARB_bindless_texture", "GL_ARB_get_program_binary"}
325+
ctx.extensions & expected_extensions == expected_extensions
326+
"""
327+
return gl.gl_info.get_extensions()
328+
314329
@property
315330
def stats(self) -> ContextStats:
316331
"""

tests/unit/gl/test_opengl_context.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ def test_ctx(ctx):
2121
assert ctx.blend_func == ctx.BLEND_PREMULTIPLIED_ALPHA
2222

2323

24+
def test_extensions(ctx):
25+
assert isinstance(ctx.extensions, set)
26+
assert len(ctx.extensions) > 0
27+
28+
2429
def test_viewport(ctx):
2530
vp = 0, 0, 100, 100
2631
ctx.viewport = vp

0 commit comments

Comments
 (0)