kopia lustrzana https://github.com/jameshball/osci-render
Fix capped floats on windows
rodzic
596a4a5665
commit
a43e1c6f9a
|
@ -40,7 +40,7 @@ void main() {
|
||||||
brightness = erf(xy.x/SQRT2/sigma) - erf((xy.x-len)/SQRT2/sigma);
|
brightness = erf(xy.x/SQRT2/sigma) - erf((xy.x-len)/SQRT2/sigma);
|
||||||
brightness *= exp(-xy.y*xy.y/(2.0*sigma*sigma))/2.0/len;
|
brightness *= exp(-xy.y*xy.y/(2.0*sigma*sigma))/2.0/len;
|
||||||
}
|
}
|
||||||
|
|
||||||
brightness *= uvl.w;
|
brightness *= uvl.w;
|
||||||
gl_FragColor = 2.0 * texture2D(uScreen, vTexCoord) * brightness;
|
gl_FragColor = 2.0 * texture2D(uScreen, vTexCoord) * brightness;
|
||||||
gl_FragColor.a = 1.0;
|
gl_FragColor.a = 1.0;
|
||||||
|
|
|
@ -284,8 +284,6 @@ void VisualiserComponent::childUpdated() {
|
||||||
|
|
||||||
void VisualiserComponent::newOpenGLContextCreated() {
|
void VisualiserComponent::newOpenGLContextCreated() {
|
||||||
using namespace juce::gl;
|
using namespace juce::gl;
|
||||||
|
|
||||||
glDebugMessageControl(GL_DEBUG_SOURCE_API, GL_DEBUG_TYPE_OTHER, GL_DEBUG_SEVERITY_NOTIFICATION, 0, 0, GL_FALSE);
|
|
||||||
|
|
||||||
juce::CriticalSection::ScopedLockType lock(samplesLock);
|
juce::CriticalSection::ScopedLockType lock(samplesLock);
|
||||||
|
|
||||||
|
@ -474,7 +472,7 @@ Texture VisualiserComponent::makeTexture(int width, int height) {
|
||||||
GLuint textureID;
|
GLuint textureID;
|
||||||
glGenTextures(1, &textureID);
|
glGenTextures(1, &textureID);
|
||||||
glBindTexture(GL_TEXTURE_2D, textureID);
|
glBindTexture(GL_TEXTURE_2D, textureID);
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_FLOAT, nullptr);
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, width, height, 0, GL_RGBA, GL_FLOAT, nullptr);
|
||||||
|
|
||||||
// Set texture filtering and wrapping
|
// Set texture filtering and wrapping
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
|
@ -702,8 +700,6 @@ void VisualiserComponent::fade() {
|
||||||
|
|
||||||
void VisualiserComponent::drawCRT() {
|
void VisualiserComponent::drawCRT() {
|
||||||
using namespace juce::gl;
|
using namespace juce::gl;
|
||||||
|
|
||||||
saveTextureToQOI(lineTexture, juce::File::getSpecialLocation(juce::File::SpecialLocationType::userDesktopDirectory).getChildFile("line.qoi"));
|
|
||||||
|
|
||||||
setNormalBlending();
|
setNormalBlending();
|
||||||
|
|
||||||
|
@ -711,40 +707,34 @@ void VisualiserComponent::drawCRT() {
|
||||||
setShader(texturedShader.get());
|
setShader(texturedShader.get());
|
||||||
texturedShader->setUniform("uResizeForCanvas", lineTexture.width / 1024.0f);
|
texturedShader->setUniform("uResizeForCanvas", lineTexture.width / 1024.0f);
|
||||||
drawTexture(lineTexture);
|
drawTexture(lineTexture);
|
||||||
saveTextureToQOI(blur1Texture, juce::File::getSpecialLocation(juce::File::SpecialLocationType::userDesktopDirectory).getChildFile("blur1.qoi"));
|
|
||||||
|
|
||||||
//horizontal blur 256x256
|
//horizontal blur 256x256
|
||||||
activateTargetTexture(blur2Texture);
|
activateTargetTexture(blur2Texture);
|
||||||
setShader(blurShader.get());
|
setShader(blurShader.get());
|
||||||
blurShader->setUniform("uOffset", 1.0f / 256.0f, 0.0f);
|
blurShader->setUniform("uOffset", 1.0f / 256.0f, 0.0f);
|
||||||
drawTexture(blur1Texture);
|
drawTexture(blur1Texture);
|
||||||
saveTextureToQOI(blur2Texture, juce::File::getSpecialLocation(juce::File::SpecialLocationType::userDesktopDirectory).getChildFile("blur2.qoi"));
|
|
||||||
|
|
||||||
//vertical blur 256x256
|
//vertical blur 256x256
|
||||||
activateTargetTexture(blur1Texture);
|
activateTargetTexture(blur1Texture);
|
||||||
blurShader->setUniform("uOffset", 0.0f, 1.0f / 256.0f);
|
blurShader->setUniform("uOffset", 0.0f, 1.0f / 256.0f);
|
||||||
drawTexture(blur2Texture);
|
drawTexture(blur2Texture);
|
||||||
saveTextureToQOI(blur1Texture, juce::File::getSpecialLocation(juce::File::SpecialLocationType::userDesktopDirectory).getChildFile("blur1_2.qoi"));
|
|
||||||
|
|
||||||
//preserve blur1 for later
|
//preserve blur1 for later
|
||||||
activateTargetTexture(blur3Texture);
|
activateTargetTexture(blur3Texture);
|
||||||
setShader(texturedShader.get());
|
setShader(texturedShader.get());
|
||||||
texturedShader->setUniform("uResizeForCanvas", 1.0f);
|
texturedShader->setUniform("uResizeForCanvas", 1.0f);
|
||||||
drawTexture(blur1Texture);
|
drawTexture(blur1Texture);
|
||||||
saveTextureToQOI(blur3Texture, juce::File::getSpecialLocation(juce::File::SpecialLocationType::userDesktopDirectory).getChildFile("blur3.qoi"));
|
|
||||||
|
|
||||||
//horizontal blur 64x64
|
//horizontal blur 64x64
|
||||||
activateTargetTexture(blur4Texture);
|
activateTargetTexture(blur4Texture);
|
||||||
setShader(blurShader.get());
|
setShader(blurShader.get());
|
||||||
blurShader->setUniform("uOffset", 1.0f / 32.0f, 1.0f / 60.0f);
|
blurShader->setUniform("uOffset", 1.0f / 32.0f, 1.0f / 60.0f);
|
||||||
drawTexture(blur3Texture);
|
drawTexture(blur3Texture);
|
||||||
saveTextureToQOI(blur4Texture, juce::File::getSpecialLocation(juce::File::SpecialLocationType::userDesktopDirectory).getChildFile("blur4.qoi"));
|
|
||||||
|
|
||||||
//vertical blur 64x64
|
//vertical blur 64x64
|
||||||
activateTargetTexture(blur3Texture);
|
activateTargetTexture(blur3Texture);
|
||||||
blurShader->setUniform("uOffset", -1.0f / 60.0f, 1.0f / 32.0f);
|
blurShader->setUniform("uOffset", -1.0f / 60.0f, 1.0f / 32.0f);
|
||||||
drawTexture(blur4Texture);
|
drawTexture(blur4Texture);
|
||||||
saveTextureToQOI(blur3Texture, juce::File::getSpecialLocation(juce::File::SpecialLocationType::userDesktopDirectory).getChildFile("blur3_2.qoi"));
|
|
||||||
|
|
||||||
activateTargetTexture(renderTexture);
|
activateTargetTexture(renderTexture);
|
||||||
setShader(outputShader.get());
|
setShader(outputShader.get());
|
||||||
|
@ -759,7 +749,6 @@ void VisualiserComponent::drawCRT() {
|
||||||
outputShader->setUniform("uColour", colour.getFloatRed(), colour.getFloatGreen(), colour.getFloatBlue());
|
outputShader->setUniform("uColour", colour.getFloatRed(), colour.getFloatGreen(), colour.getFloatBlue());
|
||||||
activateTargetTexture(renderTexture);
|
activateTargetTexture(renderTexture);
|
||||||
drawTexture(lineTexture, blur1Texture, blur3Texture, screenTexture);
|
drawTexture(lineTexture, blur1Texture, blur3Texture, screenTexture);
|
||||||
saveTextureToQOI(renderTexture, juce::File::getSpecialLocation(juce::File::SpecialLocationType::userDesktopDirectory).getChildFile("render.qoi"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Texture VisualiserComponent::createScreenTexture() {
|
Texture VisualiserComponent::createScreenTexture() {
|
||||||
|
|
Ładowanie…
Reference in New Issue