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
1
vote
1 answer

Passing Data Through GLSL Shaders

I'm having some trouble passing data through my shaders, notably the Geometry shader. I've never used a Geometry Shader before so I'm having a little trouble understanding the way it passes data. Basically, before the Geometry shader, I'd pass data…
Seagull
  • 13
  • 5
1
vote
2 answers

Screen-space distance along line strip in GLSL

When rendering a line strip, how do I get the distance of a fragment to the start point of the whole strip along the line in pixels? When rendering a single line segment between two points in 3D, the distance between those two points in screen space…
mOfl
  • 478
  • 3
  • 14
1
vote
1 answer

GLSL EndPrimitive() breaks triangle strip

I'm experimenting with geometry shaders on a Macbook Pro with Intel HD 4000 graphics running Mavericks. I'm noticing some odd behavior from an EndPrimitive() call. Here's my geometry shader: #version 150 core layout(points)…
anthonyvd
  • 7,329
  • 4
  • 30
  • 51
1
vote
2 answers

opengl Draw Oval not Circle

if I call the function DrawFilledCircleo() it makes an oval and not a circle , even if i put glBegin(GL_LINE_LOOP); it always makes Oval void drawFilledCircle(GLfloat x, GLfloat y, GLfloat radius){ int i; int triangleAmount = 20; //# of…
NPLS
  • 521
  • 2
  • 8
  • 20
1
vote
1 answer

Geometry shader, MaxVertexCount cannot be known

I am currently working on a shader where the amount of vertices are not defined by the amount of triangles, my shader puts a cuber every X units. This means that I cannot know in advance how many cubes it will create and I do not know many vertices…
Subject009
  • 79
  • 1
  • 10
1
vote
1 answer

Pass-through geometry shader

I just started with OpenGL in conjunction with Qt. I try to use a geometry shader to change the width of lines, but even a simple pass-through geometry shader results in an empty screen. Here is (an excerpt of) my…
user2970139
  • 557
  • 5
  • 13
1
vote
1 answer

Is it possible to draw a sphere with strands using a unique geometry shader?

I'd like to display a simple UV sphere (exported from Blender) and generate lines with normal coordinates using a unique geometry shader. In a first time, I wrote a simple geometry shader which simply return the input vertices informations to the…
user1364743
  • 5,283
  • 6
  • 51
  • 90
1
vote
1 answer

How can I find the interpolated position between 4 vertices in a fragment shader?

I'm creating a shader with SharpDX (DirectX11 in C#) that takes a segment (2 points) from the output of a Vertex Shader and then passes them to a Geometry Shader, which converts this line into a rectangle (4 points) and assigns the four corners a…
c4sh
  • 701
  • 1
  • 8
  • 22
1
vote
1 answer

Calculate Normals Geometry Shader

Im currently writing my own GLSL shaders, and wanted to have smooth shading. The shading worked when i calculated the normals bevore sending them to a VBO, but the problem here is when I implement animations with bone matricies, the normals are not…
Leo
  • 11
  • 2
  • 7
1
vote
0 answers

Rotating verticies created by a geometry shader

I am trying to generate a cube from 6 points (each point representing a side, then 2 extra values to say if its rotated to face on the x, or y axis, z axis doesn't need one because its like that by default). Problem comes in when I try to multiply…
Lemon Drop
  • 2,113
  • 2
  • 19
  • 34
1
vote
1 answer

GLSL How to show normals with Geometry shader?

I have vertex shader #version 330 core layout(location = 0) in vec3 VertexPosition; layout(location = 1) in vec2 VertexUV; layout(location = 2) in vec3 VertexNormal; out VS_GS_VERTEX { vec2 UV; vec3 vs_worldpos; vec3 vs_normal; }…
user2091150
  • 978
  • 12
  • 25
1
vote
1 answer

How come I pass thru more vertices than I can generate in GLSL Geometry Shaders?

How come I can pass my geometry shader N (where N is a very high number, like 10000) vertices and render them like this: for (int i = 0; i < gl_VerticesIn; ++i) { gl_Position = projectionmodelview_matrix_ * gl_PositionIn[i]; …
Viktor Sehr
  • 12,825
  • 5
  • 58
  • 90
1
vote
1 answer

corrupted primitives out of geometry shader opengl 3.2 GLSL 150

I have a simple geometry shader which I am using to calculate per face normals. VertexShader #version 150 in vec3 in_Position; uniform mat4 modelMat; uniform vec3 scale; void main(void) { // scale the verts vec3 scaledPosition = vec3(…
B_o_b
  • 459
  • 1
  • 3
  • 9
1
vote
1 answer

generate vertices using geometry shader(GLSL)

recently I'm trying to implement an algorithm to generate vine in real time. I kinda know how to do it on cpu, but I want to use GPU to accomplish this. I was thinking of geometry shader, but it looks like geometry shader executes in primitive…
Nowibananatzki
  • 756
  • 1
  • 9
  • 19
1
vote
1 answer

GLSL geometry value changing when it shouldnt

I'm working with a VERY simple program that is passing an array of points into the programable pipline to draw a cube. I'm trying to set it up so I can change the geometry every frame (based on some external input) and as such, for lighting, I need…
APalmer
  • 919
  • 3
  • 11
  • 22