filterview

This commit is contained in:
2026-01-23 17:18:02 +13:00
parent 87cafe3a05
commit 7dd7ec43cd
8 changed files with 247 additions and 90 deletions

View File

@@ -32,21 +32,15 @@ CrushView::CrushView()
backgroundVertices.push_back(VertexTexture{{1, 1}, {255.0f, 255.0f, 255.0f, 255.0f}, {1.0f, 1.0f}});
backgroundIndices = {0,1,2,1,2,3};
antialiasing.multisamplingLevel = 3;
ctx.setPixelFormat(antialiasing);
setOpaque(true);
ctx.setContinuousRepainting(true);
ctx.setRenderer(this);
ctx.attachTo(*this);
}
CrushView::~CrushView()
{
bgTexture.bind();
bgTexture.release();
shaderProgram->release();
shaderProgramBackground->release();
ctx.detach();
}
void CrushView::distortWaveForm(int samplerate){
@@ -76,7 +70,13 @@ void CrushView::resized()
void CrushView::newOpenGLContextCreated(){
// antialiasing.multisamplingLevel = 3;
// ctx.setPixelFormat(antialiasing);
background = juce::ImageCache::getFromMemory(BinaryData::panel_png, BinaryData::panel_pngSize);
printf("loaded bg\n");
background.duplicateIfShared();
printf("duplicatedBackground\n");
bgTexture.loadImage(background);
ctx.extensions.glGenBuffers(1, &vboBackground);
@@ -138,7 +138,6 @@ void CrushView::renderOpenGL(){
ctx.extensions.glEnableVertexAttribArray(2);
juce::gl::glDrawElements(juce::gl::GL_TRIANGLES, backgroundIndices.size(), juce::gl::GL_UNSIGNED_INT, nullptr);
bgTexture.unbind();
ctx.extensions.glBindBuffer(juce::gl::GL_ARRAY_BUFFER, vbo);
ctx.extensions.glBindBuffer(juce::gl::GL_ELEMENT_ARRAY_BUFFER, ibo);