Hello there,

I have been trying to record geometry shader output coordinates with transform feedback but I cannot seem to make it work.

The problem is that shader program outputs location = -1 error on uniforms in shader class which are in geometry shaders, But on control test without Transform feedback my class for shader class seems to allocate all my uniforms correctly.

The other possible problem is that since I have been setting transform feedback by the book in open.gl/feedback I may have not set up my geometry shader properly.

main cpp transform feedback in game loop

```
//Camera
glm::mat4 ortho = glm::ortho(-20.f, 20.f, -20.f, 20.f);
glm::mat4 translate = glm::translate(glm::mat4(1.0f), campos);
glm::mat4 rotate = glm::rotate(glm::mat4(1.0f), CAMangle, glm::vec3(0.0, 0.0, 1.0));
glm::mat4 scale = glm::scale(glm::mat4(1.0f), glm::vec3(zoom, zoom, 0));
glm::mat4 unionmatrix = ortho * translate * rotate * scale; //lumping together all needed transformation matrices
// Coloring
transform.engage(); //using shading program
glUniformMatrix4fv(geom.Uni("mvp"), 1, GL_FALSE, glm::value_ptr(unionmatrix));
glUniform1f(geom.Uni("angle"), bangle);
glUniform1f(geom.Uni("multiplier"), multiplier);
glEnable(GL_RASTERIZER_DISCARD);
glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, TBO);
glBeginTransformFeedback(GL_LINES);
glDrawArrays(GL_LINE_STRIP, 0, 4);
glEndTransformFeedback();
glDisable(GL_RASTERIZER_DISCARD);
glFlush();
Window.update();
GLdouble feedback[4]; // hence we need both branches x and y coordinates so array equals 4
glGetBufferSubData(GL_TRANSFORM_FEEDBACK_BUFFER, 0, sizeof(feedback), feedback);
for (int i = 0; i < 4; i++) {
printf("%f
", feedback[i]);
}
```

main.cpp transform feedback outside of game loop

```
Shader vertex(GL_VERTEX_SHADER, "Source/Fractals/TREE/Shaders/fractal.vert");
Shader geometry(GL_GEOMETRY_SHADER, "Source/Fractals/TREE/Shaders/fractal.geom");
ShaderProgram transform;
transform.attachshader(vertex);
transform.attachshader(geometry);
const char* varyings[] =
{
"leftbranch",
"rightbranch"
};
glTransformFeedbackVaryings(transform.getID(), 2, varyings, GL_INTERLEAVED_ATTRIBS);
Uniform geom(transform);
geom.LocUni("angle");
geom.LocUni("multiplier");
geom.LocUni("mvp");
transform.linkProgram();
GLuint VAO;
glGenVertexArrays(1, &VAO);
glBindVertexArray(VAO);
GLdouble trunk[]
{
stemstart.x, stemstart.y,
stemend.x , stemend.y,
};
GLuint VBO;
glGenBuffers(1, &VBO);
glBindBuffer(GL_ARRAY_BUFFER, VBO);
glBufferData(GL_ARRAY_BUFFER,2*sizeof(trunk), trunk, GL_DYNAMIC_DRAW);
glVertexAttribPointer(0, 2, GL_DOUBLE, GL_FALSE, 0, 0);
glEnableVertexAttribArray(0);
//Shader fragmentTransform(GL_VERTEX_SHADER, "Source/Fractals/TREE/Shaders/tree.frag")
GLuint TBO;
glGenBuffers(1, &TBO);
glBindBuffer(GL_ARRAY_BUFFER, TBO);
glBufferData(GL_ARRAY_BUFFER, 4 * sizeof(trunk), nullptr, GL_DYNAMIC_READ);
```

vertex shader.

```
#version 450 core
layout(location = 0)in vec2 position;
out vec2 pos;
void main()
{
//gl_Position = vec4(position,0.0,1.0);
pos = position;
}
```

geometry shader.

```
#version 450 core
layout(lines) in;
layout(line_strip ,max_vertices=4) out;
in vec2 pos[2];
out dvec2 leftbranch;
out dvec2 rightbranch;
uniform float angle;// angle between midbranch
uniform float multiplier; //branch multiplier;
uniform mat4 mvp = mat4(1.0); ///matrices
vec2 midbranch = (pos[1] - pos[0]) * multiplier; //calculating the the middle branch endpoint from input line's beggining point and ending point;
void main()
{
//Defining rightbranch beggining point(vertex)
pos[1];
EmitVertex();
//Calculation and Emission of rightbranch's ending point(vertex)
rightbranch.x = mvp*(midbranch.x*cos(radians(angle)) + midbranch.y*sin(radians(angle)));
rightbranch.y = mvp*(-midbranch.x*sin(radians(angle)) + midbranch.y*cos(radians(angle)));
rightbranch + pos[1];
EmitVertex();
EndPrimitive(); //End of emmision of the branch;
//Defining leftbranch beggining point;
pos[1];
EmitVertex();
//Calculation and Emission of rightbranch's ending point(vertex)
leftbranch.x = mvp*(midbranch.x*cos(radians(-angle)) + midbranch.y*sin(radians(-angle)));
leftbranch.y = mvp*(-midbranch.x*sin(radians(-angle)) + midbranch.y*cos(radians(-angle)));
rightbranch + pos[1];
EmitVertex();
EndPrimitive();
}
```

The next goal in this program is to make fractal tree through multiple passes in transform feedback in game loop using the coordinates retrieved form Transform feedback.