renderer
FreeBodyEngine.graphics.gl44.renderer
#
MIN_GL_VERSION = (4, 4)
module-attribute
#
GL44Renderer()
#
Bases: Renderer
The OpenGL renderer. Uses OpenGL version 4.4 core - real compute shaders (glDispatchCompute), writable SSBOs, and image load/store, unlike GL33Renderer's fullscreen-fragment-shader compute emulation. A completely separate, independently selectable backend (see graphics/get_renderer()) - GL33Renderer is untouched and still exists for hardware/platforms that can't do better than 3.3.
Sets the backend's Mesh subclass; GPU context creation happens in on_initialize() instead, since it depends on a window (or lack thereof) that doesn't exist yet at construction time.
create_framebuffer
property
#
Returns GL44Framebuffer.
mesh_class = GL44Mesh
instance-attribute
#
clear(color)
#
Clears the color and depth buffers of the currently bound framebuffer to color.
clear_scissor()
#
See Renderer.clear_scissor().
create_buffer(data)
#
Wraps data in a UBOBuffer, GL44's Buffer implementation.
destroy()
#
Releases the OpenGL context (win32 only - wglMakeCurrent/wglDeleteContext are Windows-specific).
disable_depth_testing()
#
Disables GL_DEPTH_TEST.
draw_circle(radius, position, color)
#
Not yet implemented - always a no-op.
draw_line(start, end, width, color)
#
Draws a line segment from start to end using a dedicated line
shader program (self.line_program), building a fresh 2-point
VAO/VBO every call.
draw_mesh(mesh, material)
#
Binds material and draws mesh's indexed triangles. Temporarily
switches to wireframe polygon mode if material.data['render_mode']
== "wireframe".
draw_mesh_instanced(mesh, material, model_matrices, camera)
#
Draws one copy of mesh per row of model_matrices (shape
(N, 4, 4)) in a single glDrawElementsInstanced call - see
GL33Renderer.draw_mesh_instanced for the identical implementation
and its docstring (GL44 doesn't need anything version-specific for
instanced vertex-attribute arrays, so this is deliberately not
using GL44-only features like SSBOs).
enable_depth_testing()
#
Enables GL_DEPTH_TEST.
get_max_buffer_size()
#
Returns the max size of a UBOBuffer, in bytes.
get_mesh_class()
#
Returns GL44Mesh.
load_shader(vertex, fragment, injector=Injector(), geometry=None)
#
Compiles vertex/fragment (and optional geometry) FBUSL source into a GL44Shader, using injector to resolve engine-provided builtins.
on_initialize()
#
Creates (or attaches to) the OpenGL context for the current window backend (glfw/wayland/win32/x11), or - if no 'window' service is registered at all - assumes a raw offscreen context already exists and is current (a true headless compute session, see graphics.ensure_gpu_context()). Then warns (but doesn't raise) if the resulting context is below MIN_GL_VERSION, and enables GL_DEBUG_OUTPUT plus the initial viewport.
resize(size)
#
Updates the GL viewport to size, and resizes the platform-specific window surface (wayland/x11) to match.
set_blend_mode(mode)
#
See Renderer.set_blend_mode. Skips the actual GL calls if mode
already matches the last mode set, since flush() calls this between
every group even when consecutive groups share a mode.
set_scissor(x, y, width, height)
#
See Renderer.set_scissor(). x/y come in top-left-origin,
Y-down (UIRenderer's convention) - glScissor wants bottom-left
origin, so y is flipped against the framebuffer height.
swap_buffers()
#
Swaps the front/back buffers for a manually-created wayland/x11 context. glfw drives its own swap directly (see core/window/glfw.py) instead of going through the renderer, so this is a no-op there.
debug_callback(source, type, id, severity, length, message, userParam)
#
GL_DEBUG_OUTPUT callback (see glDebugMessageCallback in on_initialize) - decodes the driver's UTF-8 message and prints it, so GL errors/ warnings surface immediately instead of needing a manual glGetError() poll.