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
0 answers

memoryBarrier() behaving unexpectedly in Geometry Shader

I am trying to get a hold of how memoryBarrier() works in OpenGL 4.4 I tried the following once with a texture image and once with Shader Storage Buffer Object (SSBO). The basic idea is to create an array of flags for however many objects that…
MaYa
  • 180
  • 7
2
votes
1 answer

HLSL: Triangle-2-Points/Lines Geometry Shader issue

I'm trying extend a renderer (for TressFX) with a Geometry Shader, and therefore I'm taking babysteps in order to see that everything works as it should. Therefore I've created a simpel pass-through Geometry Shader, which works for triangles, but…
Axloss
  • 21
  • 1
  • 2
2
votes
1 answer

Single-pass wireframe issue

I am trying to implement single-pass wireframe, but I have got couple of issues in the process. Question #1 For some reasons I get only wireframe without (like with glPolygoneMode - lines) filled geometry after my geometry shader worked.   ) But if…
frankie
  • 728
  • 1
  • 10
  • 28
2
votes
1 answer

Vertex attribute data passed to geometry shader is not set properly

Here is the code: Vertex shader: #version 330 layout(std140) uniform; layout(location = 6) in vec4 worldPosition; layout(location = 7) in int FIndex; flat out int[] passFIndex; uniform Projection { mat4 view; mat4…
Thomas
  • 6,032
  • 6
  • 41
  • 79
2
votes
1 answer

'gl_VerticesIn' : undeclared identifier

Why do I get this error compiling a GLSL geometry shader? ERROR: 0:15: 'gl_VerticesIn' : undeclared identifier Here's the shader: // makes wireframe triangles. #version 330 #extension GL_ARB_geometry_shader4 : enable layout(triangles)…
KTC
  • 420
  • 5
  • 15
2
votes
1 answer

OpenGL Geometry Extrusion with geometry Shader

With the GLE Tubing and Extrusion Library (http://www.linas.org/gle/) I am able to extrude 2D countours into 3D objects using OpenGL. The Library does all the work on the CPU and uses OpenGL immediate mode. I guess doing the extrusion on the GPU…
trenki
  • 7,133
  • 7
  • 49
  • 61
2
votes
1 answer

optimizing cubes rendering with geometry shader

In my first opengl 'voxel' project I'm using geometry shader to create cubes from gl_points and it works pretty well but I'm sure it can be done better. In the alpha color I'm passing info about which faces should be rendered ( to skip faces…
laggyluk
  • 195
  • 2
  • 14
2
votes
1 answer

How do I pass vertex color through the shader pipeline?

I am trying to pass vertex color through the vertex, geometry and fragment shader: glBegin(GL_POINTS); glVertex3f(-2.0f, 0.0f, 0.0); glColor3f(0.0,1.0,0.0); glVertex3f(+2.0f, 0.0f, 0.0); glColor3f(0.0,0.0,1.0); glEnd(); vertex shader: #…
Andy
  • 3,251
  • 4
  • 32
  • 53
2
votes
0 answers

Geometry Shader on MacOS

I'm trying to write a simple pass-through geometry shader, but it's not working and I don't really get why. Here's my gs: #version 120 #extension GL_EXT_geometry_shader4 : enable void main(void) { for(int i=0; i< gl_VerticesIn; i++) { …
Manlio
  • 10,768
  • 9
  • 50
  • 79
2
votes
0 answers

Queries regarding Geometry Shaders

I am dealing with geometry shaders using GL_ARB_geometry_shader4 extension. My code goes like : GLfloat vertices[] = { 0.5,0.25,1.0, 0.5,0.75,1.0, -0.5,0.75,1.0, -0.5,0.25,1.0, 0.6,0.35,1.0, …
maverick9888
  • 498
  • 6
  • 16
2
votes
1 answer

How do you use Geometry Shader with Output Stream?

It seems that this feature is very poorly documented.In the Geometry Shader tutorials in the DirectX SDK there is no example of using CreateGeometryShaderWithStreamOutput and there are no threads anywhere that explain the basics of it.In msdn they…
user1700893
  • 21
  • 1
  • 2
2
votes
1 answer

Per-frame geometry modification: OpenCL or GLSL geometry shader?

I'm building water surfaces, where I want sinusoidal vertex shifting to get the effect of waves on the water. My understanding prior to picking up OpenGL was that this is best done in a geometry shader. Presently, however, I'm working with the…
Engineer
  • 8,529
  • 7
  • 65
  • 105
1
vote
1 answer

Geometry shader receives extra point on origin

I have a very strange problem with using geometry shaders. I made a very simple geometry shader which takes a point and transforms it into a triangle. here is the shader: struct GS_OUTPUT { float4 pos : SV_POSITION; }; struct VS_INPUT { …
Rui Campos
  • 453
  • 2
  • 11
1
vote
1 answer

Variable output primitives count in geometry shader GLSL

I want to do something like this in my geometry shader: uniform int maxOutputVert; layout(points) in; layout(points, max_vertices=maxOutputVert) out; However I get error while compiling it: Error: error(#132) Syntax error: 'maxOutputVert' parse…
Raven
  • 4,783
  • 8
  • 44
  • 75
1
vote
1 answer

Draw two shapes on top of each other in geometry shader?

With this small program I want to achieve: Publish a point Transform this point with vertex shader Create a square and a triangle with geometry shader Fill both the triangle and the square with fragment shader Unfortunately, I cannot manage to…
nowox
  • 25,978
  • 39
  • 143
  • 293