Skip to content

32 bit color mode for the Digital Screen#3644

Open
Bilbard wants to merge 2 commits into
wiremod:masterfrom
Bilbard:master
Open

32 bit color mode for the Digital Screen#3644
Bilbard wants to merge 2 commits into
wiremod:masterfrom
Bilbard:master

Conversation

@Bilbard

@Bilbard Bilbard commented Jul 1, 2026

Copy link
Copy Markdown

I added a 32 bit color mode to the Digital Screen for use with EGP rendering.

I think we should consider refreshing the Digital Screen when the color mode changes; I've noticed that pixels sometimes become unresponsive when writing to them with any 2 modes, and subsequently rewriting 1048572 or 1048573 fixes them by causing a refresh. This seems like something that should be automatically done.

Here is video that shows some of the new effects:

dvdscreensaver.mp4

@Bilbard

Bilbard commented Jul 2, 2026

Copy link
Copy Markdown
Author

render.OverrideBlend doesn't seem to function correctly, or maybe I'm slow.

--ideally;
--set override at beginning of Draw()
render.OverrideBlend(true, BLEND_SRC_COLOR, BLEND_ZERO, BLENDFUNC_ADD, BLEND_SRC_ALPHA, BLEND_ZERO, BLENDFUNC_ADD)
...
surface.SetDrawColor(cr, cg, cb, alpha)
surface.DrawRect(x, y, 1, 1)
--this should completely overwrite whatever the destination is with the source,
--but it behaves weirdly when trying to fully clear out a pixel
--drawing a bogus pixel of any kind beforehand doesnt make it work either
...
render.OverrideBlend(false)

--in reality;
render.OverrideBlend(true, BLEND_ZERO, BLEND_ZERO, BLENDFUNC_ADD, BLEND_ZERO, BLEND_ZERO, BLENDFUNC_ADD)
--the color given to this shouldnt matter since its all supposed to
--be multiplied by 0, but if you give it an alpha of 0 it wont properly clear the pixel
--1 works though
surface.SetDrawColor(0, 0, 0, 255)
surface.DrawRect(x, y, 1, 1)
render.OverrideBlend(false)
--horrible awful, but doesnt seem to slow the game down?
surface.SetDrawColor(cr, cg, cb, alpha)
surface.DrawRect(x, y, 1, 1)
--this successfully clears the target pixel and overwrites it with the source.

The common theme seems to be that the blend override gets upset when you draw with a source alpha of 0. GMod bug?

I also experimented with doing a duplicate pixel pass in Draw() to first clear all of the updating pixels to avoid spamming blend overrides, but it ran slower than the current solution.

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