65 const OpenGLShaderProgram& program,
67 if (open_gl.
context.extensions.glGetUniformLocation(program.getProgramID(), name) >= 0)
68 return std::make_unique<OpenGLShaderProgram::Uniform>(program, name);
80 const OpenGLShaderProgram& program,
82 if (open_gl.
context.extensions.glGetAttribLocation(program.getProgramID(), name) >= 0)
83 return std::make_unique<OpenGLShaderProgram::Attribute>(program, name);
103 virtual void resized()
override;
208 return String(
"#version 300 es\n") +
"out mediump vec4 fragColor;\n" +
209 code.replace(
"varying",
"in").replace(
"texture2D",
"texture").replace(
"gl_FragColor",
"fragColor");
211 return OpenGLHelpers::translateFragmentShaderToV3(code);
222 return String(
"#version 300 es\n") + code.replace(
"attribute",
"in").replace(
"varying",
"out");
224 return OpenGLHelpers::translateVertexShaderToV3(code);
233 int error = glGetError();
234 assert(error == GL_NO_ERROR);
A base component class that integrates JUCE's Component with OpenGL rendering.
Definition open_gl_component.h:20
bool only_bottom_corners_
Flag to round only the bottom corners.
Definition open_gl_component.h:253
static bool setViewPort(Component *component, Rectangle< int > bounds, OpenGlWrapper &open_gl)
Sets the OpenGL viewport to match a specified rectangle within a component.
Definition open_gl_component.cpp:42
virtual void render(OpenGlWrapper &open_gl, bool animate)=0
Pure virtual function to render the component using OpenGL.
void addRoundedCorners()
Adds rounded corners to the component's edges.
Definition open_gl_component.cpp:138
virtual void resized() override
Called when the component is resized.
Definition open_gl_component.cpp:121
void setSkinOverride(Skin::SectionOverride skin_override)
Sets a skin override to control the component's color scheme.
Definition open_gl_component.h:199
void addBottomRoundedCorners()
Adds rounded corners only at the bottom of the component.
Definition open_gl_component.cpp:143
const vital::StatusOutput * num_voices_readout_
StatusOutput for voice count lookups.
Definition open_gl_component.h:258
void setParent(const SynthSection *parent)
Sets a pointer to the parent SynthSection for skin value lookups.
Definition open_gl_component.h:178
static std::unique_ptr< OpenGLShaderProgram::Attribute > getAttribute(const OpenGlWrapper &open_gl, const OpenGLShaderProgram &program, const char *name)
Retrieves an attribute from the shader program if it exists.
Definition open_gl_component.h:79
void renderCorners(OpenGlWrapper &open_gl, bool animate, Colour color, float rounding)
Renders the corner shapes using the given color and rounding amount.
Definition open_gl_component.cpp:153
static void setScissorBounds(Component *component, Rectangle< int > bounds, OpenGlWrapper &open_gl)
Sets the OpenGL scissor region to a specified rectangle within a component.
Definition open_gl_component.cpp:82
Colour getBodyColor() const
Retrieves the component's body color.
Definition open_gl_component.h:172
force_inline void checkGlError()
Checks for and asserts that there are no OpenGL errors.
Definition open_gl_component.h:231
static void setScissor(Component *component, OpenGlWrapper &open_gl)
Sets the OpenGL scissor region to the entire component's local bounds.
Definition open_gl_component.cpp:78
float findValue(Skin::ValueId value_id)
Finds a float value from the skin associated with this component's parent.
Definition open_gl_component.cpp:173
virtual void destroy(OpenGlWrapper &open_gl)
Destroys any OpenGL-specific resources allocated by this component.
Definition open_gl_component.cpp:168
static String translateFragmentShader(const String &code)
Translates a fragment shader code snippet to be compatible with the current GL version.
Definition open_gl_component.h:206
OpenGlComponent(String name="")
Constructs an OpenGlComponent.
Definition open_gl_component.cpp:34
virtual ~OpenGlComponent()
Destructor.
Definition open_gl_component.cpp:40
void setBackgroundColor(const Colour &color)
Sets the background color of the component for painting operations.
Definition open_gl_component.h:242
static std::unique_ptr< OpenGLShaderProgram::Uniform > getUniform(const OpenGlWrapper &open_gl, const OpenGLShaderProgram &program, const char *name)
Retrieves a uniform from the shader program if it exists.
Definition open_gl_component.h:64
virtual void paintBackground(Graphics &g)
Paints a standard background for the component.
Definition open_gl_component.cpp:105
Colour body_color_
The body color of the component.
Definition open_gl_component.h:255
virtual void init(OpenGlWrapper &open_gl)
Initializes any OpenGL-specific resources needed by the component.
Definition open_gl_component.cpp:148
Colour background_color_
The background color of the component.
Definition open_gl_component.h:254
void repaintBackground()
Requests a repaint of the component's background on the OpenGL layer.
Definition open_gl_component.cpp:112
static String translateVertexShader(const String &code)
Translates a vertex shader code snippet to be compatible with the current GL version.
Definition open_gl_component.h:220
std::unique_ptr< OpenGlCorners > corners_
Optional corners for rounded edges.
Definition open_gl_component.h:252
virtual void parentHierarchyChanged() override
Called when the component's parent hierarchy changes.
Definition open_gl_component.cpp:128
void setSkinValues(const Skin &skin)
Applies the skin overrides to this component's colors.
Definition open_gl_component.h:191
const SynthSection * parent_
Pointer to parent SynthSection for skin lookups.
Definition open_gl_component.h:256
Skin::SectionOverride skin_override_
Skin override for custom appearance.
Definition open_gl_component.h:257
A set of quads forming rounded corners, used to render corner shapes via OpenGL.
Definition open_gl_multi_quad.h:554
Manages the overall color and value theme (or "skin") of the user interface.
Definition skin.h:24
ValueId
Identifiers for various UI scaling/spacing values and configuration constants.
Definition skin.h:70
SectionOverride
Identifiers for different UI sections that can have color or value overrides.
Definition skin.h:30
void setComponentColors(Component *component) const
Applies all component colors to a given component.
Definition skin.cpp:207
Base class for all synthesizer sections, providing UI layout, painting, and interaction logic.
Definition synth_section.h:193
A helper class to track the "status" of a particular Output as a poly_float value.
Definition synth_module.h:35
#define force_inline
Definition common.h:23
A helper struct containing references to OpenGL context, shaders, and display scale.
Definition shaders.h:174
OpenGLContext & context
The OpenGLContext for current rendering.
Definition shaders.h:181
Defines the SynthModule class which extends ProcessorRouter to form a building block of the Vital syn...