Skip to content

Implement rlSetBlendMode/rlSetBlendFactors for GRAPHICS_API_OPENGL_11 - #19

Open
gingerbeardman wants to merge 1 commit into
raylib4Consoles:raylib4Consoles_6.0from
gingerbeardman:gl11-blend-modes
Open

Implement rlSetBlendMode/rlSetBlendFactors for GRAPHICS_API_OPENGL_11#19
gingerbeardman wants to merge 1 commit into
raylib4Consoles:raylib4Consoles_6.0from
gingerbeardman:gl11-blend-modes

Conversation

@gingerbeardman

@gingerbeardman gingerbeardman commented Jul 28, 2026

Copy link
Copy Markdown

rlSetBlendMode() and rlSetBlendFactors() are gated behind OPENGL_33/ES2 and compile to empty bodies on the OpenGL 1.1 path — so on PLATFORM_DREAMCAST, BeginBlendMode()/EndBlendMode() are silent no-ops and every draw is stuck at the init-time glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA).

This adds a GL 1.1 arm to both functions:

  • Blend factors are programmed with plain glBlendFunc(); state is tracked in file-scope statics since the RLGL state-shadow global is only compiled for 3.3/ES2.
  • The blend equation is deliberately not programmed: GLdc exposes no glBlendEquation and the PVR is FUNC_ADD-only. RL_BLEND_SUBTRACT_COLORS/RL_BLEND_CUSTOM_SEPARATE remain unsupported on this path.
  • rlSetBlendFactors() stores factors and marks them modified; they apply on the next BeginBlendMode(RL_BLEND_CUSTOM) — same contract as the 3.3/ES2 path.

Verified on PLATFORM_DREAMCAST under Flycast with an overlapping-shapes test: ALPHA, ADDITIVE, MULTIPLIED, CUSTOM (screen via GL_ONE, GL_ONE_MINUS_SRC_COLOR), and blending-disabled all render correctly. Happy to attach the verification screenshot.

raylib-gl11-blend-verification

Both functions were gated behind OPENGL_33/ES2 and compiled to empty
bodies on the OpenGL 1.1 path, so BeginBlendMode()/EndBlendMode() were
silent no-ops on PLATFORM_DREAMCAST - every draw stayed at the init-time
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA).

Adds a GL 1.1 arm that programs blend factors with plain glBlendFunc().
Blend state is tracked in small file-scope statics because the RLGL
state-shadow global is only compiled for 3.3/ES2. The blend equation is
not programmed: GLdc (the Dreamcast GL driver) exposes no glBlendEquation
and the PVR is FUNC_ADD-only, so RL_BLEND_SUBTRACT_COLORS and
RL_BLEND_CUSTOM_SEPARATE remain unsupported on this path.
rlSetBlendFactors() stores factors and marks them modified, applied on
the next BeginBlendMode(RL_BLEND_CUSTOM), matching the 3.3/ES2 contract.

Verified on PLATFORM_DREAMCAST under Flycast: ALPHA, ADDITIVE,
MULTIPLIED, CUSTOM (screen: GL_ONE, GL_ONE_MINUS_SRC_COLOR), and
blend-disabled rendering all behave correctly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant