Questions tagged [geometry-shader]

Geometry shader should not be mixed up with [vertex-shader], but are shader programs executed after vertex shaders. They take as input a whole primitive like point, line or triangle.

Geometry shaders are the 3rd type of GPU shader programs after and and process whole primitives like points, lines or triangles.

Resources

232 questions
2
votes
2 answers

THREE.JS SHADER: Apply color gradient blend to geometry on multiple axes?

Using the information from Apply color gradient to material on mesh - three.js I was able to create a flower shader that applies the color vertically across the space of the Zinnia. The color blends vertically across the space of the flower from red…
2
votes
1 answer

GLSL geometry shader: iterate over entire mesh

My goal was to color the vertexes according to their order EDIT: long time goal: access to preceding and following vertexes to simulate gravity behavior i've used following code #version 120 #extension GL_EXT_geometry_shader4 : enable void main(…
Valerij
  • 27,090
  • 1
  • 26
  • 42
2
votes
1 answer

Qt3D geometry shader working in QML but not in C++

Update The OpenGL version seems to be 4.3 at least according to the following code QSurfaceFormat format = view.format(); int major = format.majorVersion(); int minor = format.minorVersion(); so geometry shaders should work and the issue seems to…
Florian Blume
  • 3,237
  • 17
  • 37
2
votes
1 answer

Prune Primitives using Geometry Shaders in OpenGL

I have a large 2D Triangle(not Triangle Strip) mesh with about 2+ million polygons. Many of these polygons are redundant which can be determined using one of the attribute variables in vertex shader. But since discarding a vertex in vertex shader is…
Abhishek Bansal
  • 5,197
  • 4
  • 40
  • 69
2
votes
1 answer

EmitVertex gives "error C1067: too little data in type constructor"

I am using geometry shaders to generate cubes from GL_POINTS #version 150 core layout(points) in; layout(triangle_strip, max_vertices = 18) out; in vec3 g_col[]; out vec3 f_col; uniform mat4 transform; void main() { f_col = g_col[0]; …
spraff
  • 32,570
  • 22
  • 121
  • 229
2
votes
1 answer

Why is my geometry shader becoming "overloaded"?

I use an OpenGL shader to plot graphs. Every span of the graph has the form: The vertex shader just passes the a's and b's to a geometry shader that then evaluates the curve at max_vertices points. The problem is that sometimes the geometry shader…
Neil G
  • 32,138
  • 39
  • 156
  • 257
2
votes
0 answers

Geometry shader equivalent in WebGL

I am working with light propagation volumes and I have stumbled upon a problem with WebGL where I need a geometry shader or something to emulate it. I am working with 3D textures and I need to be able to render to a 3D texture. I found this in guide…
Marcus
  • 164
  • 1
  • 13
2
votes
1 answer

Is there a way to discard geometry, vertices or fragments in OpenGL shaders?

I am using instanced rendering to draw a large amount of cubes. Now, obviously the maximum amount of visible faces in a cube is 3, which means that in terms of shading, I am doing twice as more works as needed. Because this is instancing I cannot…
Makogan
  • 8,208
  • 7
  • 44
  • 112
2
votes
2 answers

Geometry shader doesn't do anything when fed GL_POINTS

I'm trying to use geometry shaders to turn points into line segments (GL_POINTS to GL_LINE_STRIP), but no line segments appear. If I change the input to GL_LINES, and just repeat the vertex, then I get the behavior I'm expecting. What's going…
Jay Kominek
  • 8,674
  • 1
  • 34
  • 51
2
votes
1 answer

OpenGL 4.4 transform feedback layout specifier

I'm having problems using Transform Feedback buffers with OpenGL version 4.4. I'm using geometry shader output for capturing and drawing triangles. The triangles will be culled by some algorithm in the geometry shader and I want to capture the…
Gábor Fekete
  • 1,343
  • 8
  • 16
2
votes
1 answer

Using GLES31ext on Android to compile geometry shader?

I would like to attach a geometry shader to my existing (and working) vertex and fragment shaders. The snippet responsible for building the program: int geometryShader = GLES31.glCreateShader(GLES31Ext.GL_GEOMETRY_SHADER_EXT); …
andras
  • 3,305
  • 5
  • 30
  • 45
2
votes
1 answer

In OpenGL is it guaranteed that a geometry shader will receive vertices within a primitive in their original order?

For instance, if a glDraw* call drawing GL_TRIANGLES reads a set of VBOs that specify vertices A, B, C, D, E, and F in that order, then one would expect that in one invocation of the geometry shader, the following would be true: gl_in[0] describes…
mjwach
  • 1,174
  • 2
  • 9
  • 25
2
votes
1 answer

Geometry shader doesn't seem to accept input attribute

I am passing a line to the geometry shader and outputting a cuboid. I create 4 new points at each end of the line which was passed in by adding a constant "thickness" in the x or y direction. If I set the thickness in the geometry shader, it works…
pseudomarvin
  • 1,477
  • 2
  • 17
  • 32
2
votes
1 answer

How to draw TRIANGLE_FAN with geometry shader created coordinates? (GLSL 3.3)

I want to draw multiple fans with a GS. Each fan should billboard to the camera at each time, which makes it necessary that each vertex is multiplied with MVP matrix. Since each fan is movable by the user, I came up with the idea to feed the GS with…
user3054986
  • 417
  • 7
  • 18
2
votes
0 answers

Tessellation and Geometry shader with GL_TRIANGLES_ADJACENCY_EXT

I have a little program that render terrain from some SRTM data. i'm playing a bit with glsl new featutes. I've successfully create a vs, tcs, tes, gs and fs where gs was only a pass through shader with: #version 430 layout(triangles_adjacency)…