Skip to content

Commit b30c6e8

Browse files
committed
RF noise reduced to zero during screenshots
the TV image may noticeably change brightness during the duration screenshot because of the absence of noise
1 parent f9ce6ed commit b30c6e8

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

gui/sdlimgui/gl32.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,6 @@ func (rnd *gl32) render() {
193193
} else {
194194
// texture id
195195
id := cmd.TextureID()
196-
197196
env.textureID = uint32(id)
198197

199198
// select shader program to use

gui/sdlimgui/gl32_crtseq.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ func newCRTSequencer(img *SdlImgui) *crtSequencer {
106106
sharpenShader: newSharpenShader(),
107107
phosphorShader: newPhosphorShader(),
108108
blurShader: newBlurShader(),
109-
effectsShader: newEffectsShader(),
109+
effectsShader: newEffectsShader(img.rnd),
110110
colorShader: newColorShader(),
111111
}
112112
return sh

gui/sdlimgui/gl32_crtseq_effects.go

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,22 @@ type effectsShader struct {
5454
rotation int32
5555
screenshot int32
5656
time int32
57+
58+
isScrsht isScreenshotting
59+
}
60+
61+
// used by the effects shader to determine if a screenshot is taking place. if
62+
// it is then specific effects settings are used with the aim of improving the
63+
// screenshot image
64+
type isScreenshotting interface {
65+
isScreenshotting() bool
5766
}
5867

59-
func newEffectsShader() shaderProgram {
60-
sh := &effectsShader{}
68+
func newEffectsShader(isScrsht isScreenshotting) shaderProgram {
69+
sh := &effectsShader{
70+
isScrsht: isScrsht,
71+
}
72+
6173
sh.createProgram(string(shaders.StraightVertexShader), string(shaders.CRTEffectsFragShader))
6274

6375
sh.screenDim = gl.GetUniformLocation(sh.handle, gl.Str("ScreenDim"+"\x00"))
@@ -125,4 +137,9 @@ func (sh *effectsShader) setAttributesArgs(env shaderEnvironment, numScanlines i
125137
gl.Uniform1i(sh.rotation, int32(rotation))
126138
gl.Uniform1i(sh.screenshot, boolToInt32(screenshot))
127139
gl.Uniform1f(sh.time, float32(time.Now().Nanosecond())/100000000.0)
140+
141+
// no noise when a screenshot is taking place
142+
if sh.isScrsht.isScreenshotting() {
143+
gl.Uniform1f(sh.rfNoiseLevel, float32(0))
144+
}
128145
}

0 commit comments

Comments
 (0)