sine wave works now
This commit is contained in:
@@ -10,20 +10,61 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "juce_gui_basics/juce_gui_basics.h"
|
||||
#include "juce_opengl/juce_opengl.h"
|
||||
#include <JuceHeader.h>
|
||||
|
||||
#include "OpenGLUtils.h"
|
||||
#include <string>
|
||||
//==============================================================================
|
||||
/*
|
||||
*/
|
||||
class CrushView : public juce::Component
|
||||
#define CRUSHVIEW_SAMPLECOUNT 200
|
||||
|
||||
class CrushView : public juce::Component, public juce::OpenGLRenderer
|
||||
{
|
||||
public:
|
||||
CrushView();
|
||||
~CrushView() override;
|
||||
|
||||
void newOpenGLContextCreated() override;
|
||||
void renderOpenGL() override;
|
||||
void openGLContextClosing() override;
|
||||
|
||||
void paint (juce::Graphics&) override;
|
||||
void resized() override;
|
||||
|
||||
void distortWaveForm(int sampleRate);
|
||||
|
||||
private:
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (CrushView)
|
||||
juce::OpenGLContext ctx;
|
||||
juce::OpenGLPixelFormat antialiasing;
|
||||
|
||||
std::vector<Vertex> waveform;
|
||||
std::vector<Vertex> distortedWaveform;
|
||||
std::vector<unsigned int> indices;
|
||||
|
||||
std::vector<VertexTexture> backgroundVertices;
|
||||
std::vector<unsigned int> backgroundIndices;
|
||||
|
||||
juce::ComponentListener listener;
|
||||
|
||||
GLuint vbo;
|
||||
GLuint ibo;
|
||||
|
||||
GLuint vboBackground;
|
||||
GLuint iboBackground;
|
||||
|
||||
std::string vertexShader;
|
||||
std::string fragmentShader;
|
||||
|
||||
std::string vertexShaderBackground;
|
||||
std::string fragmentShaderBackground;
|
||||
|
||||
std::unique_ptr<juce::OpenGLShaderProgram> shaderProgram;
|
||||
std::unique_ptr<juce::OpenGLShaderProgram> shaderProgramBackground;
|
||||
|
||||
juce::Image background;
|
||||
juce::OpenGLTexture bgTexture;
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user