diff --git a/src/gui/chanOsc.cpp b/src/gui/chanOsc.cpp index e88bb8d56..4c5e29439 100644 --- a/src/gui/chanOsc.cpp +++ b/src/gui/chanOsc.cpp @@ -592,7 +592,7 @@ void FurnaceGUI::drawChanOsc() { ImGui::ItemSize(size,style.FramePadding.y); if (ImGui::ItemAdd(rect,ImGui::GetID("chOscDisplay"))) { if (!e->isRunning()) { - if (newOscCode) { + if (settings.shaderOsc) { memset(fft->oscTex,0,2048*sizeof(float)); } else { for (unsigned short j=0; j0.0000001) maxavg=0.5/maxavg; - if (newOscCode) { + if (settings.shaderOsc) { for (unsigned short j=0; j=precision/2) { @@ -666,7 +666,7 @@ void FurnaceGUI::drawChanOsc() { } dcOff=(minLevel+maxLevel)*0.5f; - if (newOscCode) { + if (settings.shaderOsc) { for (unsigned short j=0; jdata[(unsigned short)(fft->needle+(j*displaySize/precision))]/32768.0f; y-=dcOff; @@ -699,7 +699,7 @@ void FurnaceGUI::drawChanOsc() { color=chanOscGrad.get(xVal,1.0f-yVal); } - if (rend->supportsDrawOsc() && newOscCode) { + if (rend->supportsDrawOsc() && settings.shaderOsc) { fft->drawOp.gui=this; fft->drawOp.data=fft->oscTex; fft->drawOp.len=precision; diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 641647c44..7bff8b9ac 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -7298,7 +7298,6 @@ FurnaceGUI::FurnaceGUI(): safeMode(false), midiWakeUp(true), makeDrumkitMode(false), - newOscCode(true), audioEngineChanged(false), settingsChanged(false), debugFFT(false), diff --git a/src/gui/gui.h b/src/gui/gui.h index 2735228be..d2da82511 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -1507,7 +1507,6 @@ class FurnaceGUI { bool safeMode; bool midiWakeUp; bool makeDrumkitMode; - bool newOscCode; bool audioEngineChanged, settingsChanged, debugFFT; bool willExport[DIV_MAX_CHIPS]; int vgmExportVersion; @@ -1776,6 +1775,7 @@ class FurnaceGUI { int selectAssetOnLoad; int basicColors; int playbackTime; + int shaderOsc; unsigned int maxUndoSteps; String mainFontPath; String headFontPath; @@ -1976,6 +1976,7 @@ class FurnaceGUI { selectAssetOnLoad(1), basicColors(1), playbackTime(1), + shaderOsc(1), maxUndoSteps(100), mainFontPath(""), headFontPath(""), diff --git a/src/gui/osc.cpp b/src/gui/osc.cpp index d32d7aa60..82af807a7 100644 --- a/src/gui/osc.cpp +++ b/src/gui/osc.cpp @@ -293,7 +293,7 @@ void FurnaceGUI::drawOsc() { if ((oscWidth-24)>0) { if (settings.oscMono) { - if (rend->supportsDrawOsc() && newOscCode) { + if (rend->supportsDrawOsc() && settings.shaderOsc) { _do.gui=this; _do.data=&oscValuesAverage[12]; _do.len=oscWidth-24; diff --git a/src/gui/render/renderGL.cpp b/src/gui/render/renderGL.cpp index a4a8d94c5..9692fd948 100644 --- a/src/gui/render/renderGL.cpp +++ b/src/gui/render/renderGL.cpp @@ -178,14 +178,14 @@ const char* sh_oscRender_srcF= " if (val1.0) {\n" - " fur_FragColor = vec4(uColor.xyz,uColor.w*clamp(alpha/uLineWidth,0.0,1.0));\n" + " fur_FragColor = vec4(uColor.xyz,uColor.w*clamp(alpha/(uLineWidth+sqrt(slope*0.125)),0.0,1.0));\n" " } else {\n" " fur_FragColor = vec4(uColor.xyz,uColor.w*clamp(alpha/uLineWidth,0.0,1.0));\n" " }\n" diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index 56c146647..abe4acf9e 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -465,6 +465,22 @@ void FurnaceGUI::drawSettings() { } popWarningColor(); + ImGui::Text("Oscilloscope rendering engine:"); + ImGui::Indent(); + if (ImGui::RadioButton("ImGui line plot",settings.shaderOsc==0)) { + settings.shaderOsc=0; + } + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip("render using Dear ImGui's built-in line drawing functions."); + } + if (ImGui::RadioButton("GLSL/HLSL (if available)",settings.shaderOsc==1)) { + settings.shaderOsc=1; + } + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip("render using shaders that run on the graphics card.\nonly available in OpenGL render backend."); + } + ImGui::Unindent(); + // SUBSECTION FILE CONFIG_SUBSECTION("File"); @@ -3805,6 +3821,7 @@ void FurnaceGUI::readConfig(DivConfig& conf, FurnaceGUISettingGroups groups) { settings.chanOscThreads=conf.getInt("chanOscThreads",0); settings.renderPoolThreads=conf.getInt("renderPoolThreads",0); + settings.shaderOsc=conf.getInt("shaderOsc",1); settings.showPool=conf.getInt("showPool",0); settings.writeInsNames=conf.getInt("writeInsNames",0); settings.readInsNames=conf.getInt("readInsNames",1); @@ -4245,6 +4262,7 @@ void FurnaceGUI::readConfig(DivConfig& conf, FurnaceGUISettingGroups groups) { clampSetting(settings.selectAssetOnLoad,0,1); clampSetting(settings.basicColors,0,1); clampSetting(settings.playbackTime,0,1); + clampSetting(settings.shaderOsc,0,1); if (settings.exportLoops<0.0) settings.exportLoops=0.0; if (settings.exportFadeOut<0.0) settings.exportFadeOut=0.0; @@ -4270,6 +4288,7 @@ void FurnaceGUI::writeConfig(DivConfig& conf, FurnaceGUISettingGroups groups) { conf.set("chanOscThreads",settings.chanOscThreads); conf.set("renderPoolThreads",settings.renderPoolThreads); + conf.set("shaderOsc",settings.shaderOsc); conf.set("showPool",settings.showPool); conf.set("writeInsNames",settings.writeInsNames); conf.set("readInsNames",settings.readInsNames);