I am trying to create a custom GLSL node in OpenRV. When I passed the vec2 lassoPoints[256] into the main function, it showed a syntax error like this in the OpenRV console.
ERROR: compiling shader main:
ERROR: 0(3) : error C0000: syntax error, unexpected identifier, expecting ',' or ';' at token "_1"
ERROR: 0(90) : error C1068: array index out of bounds
ERROR: 0(90) : error C0000: syntax error, unexpected identifier, expecting ')' at token "_1"
ERROR: ----- source follows ----
ERROR: 1: #version 150
ERROR: 2: #extension GL_ARB_texture_rectangle : require
ERROR: 3: uniform vec2 lassoPoints[256]_1;
ERROR: main failed to compile. Cannot build program
ERROR: failed to compile/select GL program: ERROR: failed to select the GL program
This is my code .gto and .glsl file to create a custom GLSL node in OpenRV.
lasso.gto
GTOa (4)
Lasso : IPNodeDefinition (1)
{
node
{
string evaluationType = "color"
string defaultName = "Lasso"
string creator = ""
string documentation = ""
int userVisible = 1
}
render
{
int intermediate = 0
}
function
{
string name = "main"
string type = "color"
string glsl = "file://${HERE}/lasso.glsl"
}
parameters
{
float[2] lassoPoints = [ [0.0 0.0] ]
int pointCount = [0]
}
documentation
{
string summary = ""
string html = ""
}
icon
{
byte RGBA = [ ]
}
}
lasso.glsl
vec4 main(
const in inputImage in0,
const in vec2 lassoPoints[256],
const in int pointCount)
{
vec4 P = in0();
return P;
}
Now, I try to use sampler1D and sampler2D, etc. It also has errors.
vec4 main(
const in inputImage in0,
const in sampler1D lassoPoints,
const in int pointCount)
{
vec4 P = in0();
return P;
}
ERROR: compiling shader main:
ERROR: 0(89) : error C1102: incompatible type for parameter #2 ("")
ERROR: 0(89) : error C1103: too few parameters in function call
ERROR: ----- source follows ----
ERROR: 1: #version 150
ERROR: 2: #extension GL_ARB_texture_rectangle : require
ERROR: 3: uniform int pointCount_1;
ERROR: 4: uniform mat4 M_1;
ERROR: 5: uniform sampler2DRect RGBA_sampler_1;
ERROR: 6: uniform vec2 samplerSize_1;
ERROR: 7: uniform float orientation_1;
ERROR: 8: in vec2 TexCoord0;
ERROR: 9: out vec4 FragColor;
Help me please.