syphon.utils.opengl
1from typing import Any 2 3import AppKit 4 5from syphon.utils.exceptions import NSOpenGLContextNotFoundException, CGLContextNotFoundException 6 7 8def get_current_cgl_context_obj() -> Any: 9 """ 10 Get the CGL context object for the current NSOpenGLContext. 11 12 Returns: 13 - Any: The CGL context object. 14 15 Raises: 16 - NSOpenGLContextNotFoundException: If the current NSOpenGLContext cannot be retrieved. 17 - CGLContextNotFoundException: If the CGLContextObj cannot be retrieved from NSOpenGLContext. 18 """ 19 ns_ctx = AppKit.NSOpenGLContext.currentContext() 20 21 if ns_ctx is None: 22 raise NSOpenGLContextNotFoundException() 23 24 cgl_context = ns_ctx.CGLContextObj() 25 26 if cgl_context is None: 27 raise CGLContextNotFoundException() 28 29 return cgl_context
def
get_current_cgl_context_obj() -> Any:
9def get_current_cgl_context_obj() -> Any: 10 """ 11 Get the CGL context object for the current NSOpenGLContext. 12 13 Returns: 14 - Any: The CGL context object. 15 16 Raises: 17 - NSOpenGLContextNotFoundException: If the current NSOpenGLContext cannot be retrieved. 18 - CGLContextNotFoundException: If the CGLContextObj cannot be retrieved from NSOpenGLContext. 19 """ 20 ns_ctx = AppKit.NSOpenGLContext.currentContext() 21 22 if ns_ctx is None: 23 raise NSOpenGLContextNotFoundException() 24 25 cgl_context = ns_ctx.CGLContextObj() 26 27 if cgl_context is None: 28 raise CGLContextNotFoundException() 29 30 return cgl_context
Get the CGL context object for the current NSOpenGLContext.
Returns:
- Any: The CGL context object.
Raises:
- NSOpenGLContextNotFoundException: If the current NSOpenGLContext cannot be retrieved.
- CGLContextNotFoundException: If the CGLContextObj cannot be retrieved from NSOpenGLContext.