No output with OpenGL 3 Geometry Shader

I can’t manage to get a geometry shader running with OpenGL 3.2. Here’s all of my code, with the most basic geometry shader:

#include "ofMain.h"

#define GLSL150(src) "#version 150 \n" #src

class ofApp : public ofBaseApp{
public:
	void setup();
	void draw();
	
	ofShader shader;
    ofMesh mesh;
};

const char *vertexShader = GLSL150(
in vec4 position;

uniform mat4 projectionMatrix;
uniform mat4 modelViewProjectionMatrix;

void main() {
    gl_Position = modelViewProjectionMatrix * position;
}
);

const char *fragmentShader = GLSL150(
out vec4 fragColor;
 
void main() {
    fragColor = vec4(1.0);
 }
 );

const char *geometryShader = GLSL150(
layout(points) in;
layout(points, max_vertices = 1) out;

void main() {
    gl_Position = gl_in[0].gl_Position;
    EmitVertex();
    EndPrimitive();
}
);

void ofApp::setup() {
    ofBackground(0);

    shader.setupShaderFromSource(GL_VERTEX_SHADER, vertexShader);
    shader.setupShaderFromSource(GL_GEOMETRY_SHADER, geometryShader);
    shader.setupShaderFromSource(GL_FRAGMENT_SHADER, fragmentShader);
    shader.linkProgram();
    
    mesh = ofMesh::sphere(200);
}

void ofApp::draw() {

    ofTranslate(ofGetWidth() / 2, ofGetHeight() / 2);
    shader.begin();
    mesh.draw(OF_MESH_POINTS);
    shader.end();
}

int main() {

    ofGLFWWindowSettings settings;
    settings.setGLVersion(3, 2);
    ofCreateWindow(settings);
    ofRunApp(new ofApp());
}

I can’t see any visual output. Without the geometry shader, it works. The geometry shader was taken from https://open.gl/geometry#Creatingageometryshader

Any ideas?

Hi, yeah geometry shaders are a bit of pain to say the least.

It’s been a while, but I have memories of having real trouble getting certain mixes of input and output to work, even though this is not supposed to be a problem according to this: http://www.lighthouse3d.com/tutorials/glsl-tutorial/geometry-shader/

I’ve got an example of a working geometry shader here if that helps: