Skip to content

3. Get to know the framework better

ResolumeMenno edited this page Aug 16, 2019 · 1 revision

How to debug your application ?

You should now know how to compile and have basic understanding of how this framework works and probably want to create more complex plugin. But first let's have a look of what could go wrong, and how to prevent it.

Visual studio allows you to attach itself to a process. It will then be able to trigger breakpoint and have a nice variable explorer (that you can find in the bottom left windows of VS named Autos). If your shader fails to compile, an error message describing why will be displayed in the Output windows in the bottom right of VS.

It is a good idea to put a breakpoint at the line 20 of Plugin.cpp

if( !shader.Compile( vertexShaderCode, fragmentShaderCode ) )

so that you will always be warned if your shader doesn't compile.

Default uniform provided

Plugin

The Plugin class will always take care to send the following uniforms to your shader :

uniform vec2 resolution;   // The screen resolution in pixel
uniform float time;        // The time in second since the application started
uniform float deltaTime;   // The time elapsed since the last render call
uniform int frame;         // The number of frame rendered since the beginning
uniform float bpm;         // The current bpm set in resolume
uniform float phase;       // The current phase position in a 4 beat represented as a float from 0 to 1 (0 is the first beat, 0.25 the second one, ect...)

Source

// A value going from (0,0) for the top left corner to (1,1) for the bottom one
in vec2 i_uv;

Effect

// A value going from (0,0) for the top left corner to (1,1) for the bottom one
in vec2 i_uv;
// A sampler2D representing the current frame as a texture.
// You can access its value for the current pixel like thanks to the `texture()` function, example `texture( inputTexture, i_uv )`
uniform sampler2D inputTexture;

Mixer

The value for the mixer are similar as above but he gets two input texture.

uniform sampler2D textureDest;
uniform sampler2D textureSrc;

in vec2 i_uv_dest;
in vec2 i_uv_src;