Make a mesh out of a point in the geometry shader



I’d like to create a GPU particle system where each particule is created in the Geometry shader. A GL_POINTS that returns a cone for example. I whould like not to do the math that creates the cone in the Geometry shader and use a mesh that was previously loaded in a VBO instead and use a lookup table to setup the new triangles.

Who should I proceed ? My idea is to use the texture() function and point to an FBO that represents the geometry I’m using.

Any better Idea ?




The example app in examples/gl/gpuParticleSystem is a GPU particle system that creates a square for each GL_POINT. Maybe you try to modify that geometry shader to obtain your mesh.


Thanks @edapx but it’s not the point. This examle shows how to created verticies programmatically. In my case, I want to get the positions of the verticies to generate from a Buffer which location is passed in the uniforms.


Hi !

I found a technique quite different from what I was trying to do but leads to the same kind of result.

The process is explained in the openGl’s documentation

ofVbo provides a setAttributeDivisor methode that wraps glVertexAttribDivisor(), and a drawElementsInstanced methode to wrap glDrawArraysInstanced.

I’ll try this when I have time and share it.


oh yes. Have a look at examples/gl/vboMeshDrawInstancedExample


Thanks for the hint :slight_smile:

Has one ever managed to to something similare using a geometry shader, where the mesh to generate is stored only once in a buffer ?


what you want to do is called feedback transform, there’s also an example in the gl folder that shows how to do it


Its not what I’m looking for but interesting anyway :smiley:

This technique is a way to feed the vertex position array, but it’s not transforming a point into a mesh in the Geometry shader.


ah i thought you wanted to store the results of the geometry shader in a buffer