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

211 questions
50
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
  • 753
  • 1
  • 7
  • 11
12
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
  • 589
  • 2
  • 7
  • 25
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…
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,351
  • 2
  • 14
  • 22
6
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,112
  • 7
  • 51
  • 74
6
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
  • 18,941
  • 21
  • 87
  • 152
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
  • 7
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
  • 143
  • 1
  • 6
5
votes
1 answer

Dynamically create complementary triangles of a regular grid in OpenGL

I have created a regular grid which originates from a 2D image, i.e. each pixels has a vertex. There are two triangles per four pixels so that I have a triangle in the top right and in the bottom left. I use vertex and index buffers for that. Now I…
Close Call
  • 573
  • 1
  • 5
  • 16
5
votes
4 answers

Do GLSL geometry shaders work on the GMA X3100 under OSX

I am trying to use a trivial geometry shader but when run in Shader Builder on a laptop with a GMA X3100 it falls back and uses the software render. According this document the GMA X3100 does support EXT_geometry_shader4. The input is POINTS and the…
GameFreak
  • 2,652
  • 5
  • 30
  • 38
5
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
  • 6,518
  • 4
  • 41
  • 91
5
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
  • 4,848
  • 1
  • 39
  • 56
5
votes
0 answers

Calculate per Vertex Normals in Geometry Shader after Tesselation

I've succeeded in getting tesselation control and evaluation shaders to work correctly, but the lighting for my scene is still blocky because I've been calculating per (triangle) face normals, instead of per vertex. Now that I'm using tesselation,…
cdk
  • 6,425
  • 20
  • 49
5
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
  • 10,886
  • 10
  • 64
  • 120
5
votes
1 answer

Opengl Geometry shader integer texture fetch fails

I'm trying to sample an integer texture from my geometry shader running on a GeForce 330m. It seems to return other values than I load into the texture. I use this code (basically) for creating and loading the texture: glGenTextures( 1, &textureId…
dascandy
  • 6,916
  • 1
  • 25
  • 49
1
2 3
14 15