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
52
votes
3 answers

What can cause glDrawArrays to generate a GL_INVALID_OPERATION error?

I've been attempting to write a two-pass GPU implementation of the Marching Cubes algorithm, similar to the one detailed in the first chapter of GPU Gems 3, using OpenGL and GLSL. However, the call to glDrawArrays in my first pass consistently fails…
Michael Powell
  • 853
  • 2
  • 9
  • 12
16
votes
3 answers

Apply color gradient to material on mesh - three.js

I have an STL file loaded into my scene with a single colour applied to a phong material I'd like a way of applying two colours to this mesh's material with a gradient effect applied on the Z axis a like the example below.Gradient Vase]1 I have a…
Huskie69
  • 795
  • 3
  • 11
  • 31
9
votes
1 answer

Why is the geometry shader processed after the vertex shader?

In both the OpenGL and Direct3D rendering pipelines, the geometry shader is processed after the vertex shader and before the fragment/pixel shader. Now obviously processing the geometry shader after the fragment/pixel shader makes no sense, but…
7
votes
2 answers

GLSL Geometry shader and generic vertex attributes

So I've been trying for a while now, to pass a vertex attribute array into the geometry shader. It is an array of float (where the attribute per vertex is just a float value) Now, when I put this in the geometry shader: attribute float…
kamziro
  • 7,882
  • 9
  • 55
  • 78
7
votes
1 answer

Transforming and Resampling a 3D volume with numpy/scipy

UPDATE: I created a well documented ipython notebook. If you just want the code, look at the first answer. Question I've got a 40x40x40 volume of greyscale values. This needs to be rotated/shifted/sheared. Here is a useful collection of homogeneous…
lhk
  • 27,458
  • 30
  • 122
  • 201
6
votes
1 answer

GLSL 1.5 Simple Geometry shader

I'm trying to write a simple geometry shader what just passes through vertices before attempting to modify stuff. My vertex shader is #version 150 core in vec3 inPosition; in vec4 inColor; out vec4 vertexColor; void main() { vertexColor =…
user1139069
  • 1,505
  • 2
  • 15
  • 27
6
votes
3 answers

GLSL Geometry shader to replace glLineWidth

I'm trying to write a geometry shader to replace glLineWidth behavior. I want to draw lines with a customizable width (doing this with a uniform suffices for now). The lines should always have the same thickness, regardless of the camera projection…
foddex
  • 531
  • 4
  • 14
6
votes
1 answer

Using line strip adjacency with the geometry shader

So, I've been trying to draw a cylinder out of a line strip adjacency primitive with the geometry shader and it works for 4 vertices, but I want to make it so I that can apply it to longer line strips. The problem is that, it messes up completely…
chromosome
  • 85
  • 1
  • 2
  • 7
6
votes
1 answer

How to draw a square from point data with a geometry shader

I want to draw a square from point data with the geometry shader. In the vertex shader, I emit a single point. #version 330 core void main() { gl_Position = vec4(0, 0, 0, 1.0); } In the geometry shader, I want to create a triangle strip forming…
Appleshell
  • 7,088
  • 6
  • 47
  • 96
6
votes
1 answer

Triangulate a quad with a hole in it using tessellation

Is it possible to triangulate a quad with a hole in it using tesselation shader? For example, Imagine I have a Quad. Then I want to make a hole to the center of the quad. There need to be a lot more of vertices to make that hole. And the…
Jorjon
  • 5,316
  • 1
  • 41
  • 58
6
votes
1 answer

simple pass-through geometry shader with normal and color

I've written a very simple pass-through geometry shader. My input primitive is points and output primitive is also points. I also want to forward the color and normal from vertex shader to fragment shader through geometry shader. The shaders are…
Partha Bera
  • 448
  • 1
  • 3
  • 9
6
votes
3 answers

Wide lines in geometry shader behaves oddly

I'm trying to render arbitrary wide lines (in screen space) using a geometry shader. At first it seems all good, but on certain view position the lines are rendered incorrectly: The image on the left present the correct rendering (three lines on…
Luca
  • 11,646
  • 11
  • 70
  • 125
5
votes
1 answer

How to pass center of each primitive to fragment shader?

In the following example I would like to manually create points (x, y, angle) from SFML then fill a circle around each point. The angle will be used later, for now I use it for debugging. SFML draws 2 points Vertex shader convert points to -1..1…
nowox
  • 25,978
  • 39
  • 143
  • 293
5
votes
1 answer

How to pass information from vertex shader to fragment shader if there is a geometry shader active?

Before adding a geometry shader I declared a variable in the vertex shader: out vec3 normal; To be received by the fragment shader as: in vec3 normal; However if I add a geometry shader to the program, the linker tells me that normal has not…
Makogan
  • 8,208
  • 7
  • 44
  • 112
5
votes
2 answers

Wireframe shader: How to display quads and not triangles?

I have a wireframe shader that displays triangles such as on the left cube, and wanted to update it so that it would only display quads such as on the right cube. Here's the code: Shader "Custom/Wireframe" { Properties { …
user1546493
  • 133
  • 1
  • 1
  • 6
1
2 3
15 16