Questions tagged [glsl]

GLSL is the OpenGL shading language. Use this tag for questions which are specifically about shaders written in this language. For generic shader questions use [shader] instead.

Filter by
Sorted by
Tagged with
71 votes
6 answers
51k views

How can I debug GLSL shaders?

When writing non-trivial shaders (just as when writing any other piece of non-trivial code), people make mistakes.[citation needed] However, I can't just debug it like any other code - you can't just ...
Martin Ender's user avatar
  • 2,720
40 votes
4 answers
22k views

Sharing code between multiple GLSL shaders

I often find myself copy-pasting code between several shaders. This includes both certain computations or data shared between all shaders in a single pipeline, and common computations which all of my ...
Martin Ender's user avatar
  • 2,720
27 votes
2 answers
41k views

GLSL. Can someone explain why gl_FragCoord.xy / screenSize is performed and for what reason?

I'm new to shaders and know that you can color pixels with gl_FragColor but sometimes there is this thing: ...
idchlife's user avatar
  • 373
22 votes
1 answer
4k views

Why does my Perlin Noise look "blocky"?

I tried to implement Perlin Noise by myself using just the theory (following flafla2.github.io/2014/08/09/perlinnoise.html). Unfortunately I was unable to achieve the look of the "original" Perlin ...
sarasvati's user avatar
  • 323
13 votes
1 answer
5k views

Do I need to rebind uniforms or attributes when changing shader programs?

Rendering the scene usually involves more than one shader program which, in my case, all use the same attributes and share at least some of the uniforms. To have them working properly, I currently ...
Nero's user avatar
  • 1,310
10 votes
1 answer
895 views

Trying to implement Microfacet BRDF but my result images are wrong

I am trying to implement microfacet BRDF model. I am reading Sebastien Lagarde's slides. I implemented formulas to my code but i think result image is wrong. Yellow is base color of material. ...
hmkum's user avatar
  • 131
9 votes
1 answer
3k views

OpenGL specular shading - Gradient banding issues

I use Phong shading as my lighting model. Nevertheless, the specular shading produces gradients in the light cone: Hopefully you can see the gradient starting from the lower left corner expanding ...
enne87's user avatar
  • 601
3 votes
1 answer
2k views

How to dynamically calculate texture coordinates in a vertex shader with OpenGL?

I modified my code, and tried to pass a set of integers specifying the face of a cube (top, bottom left...) to the vertex shader in order to draw multiple instances of a cube face. I did this by ...
Makogan's user avatar
  • 1,696
3 votes
1 answer
1k views

Shader storage buffer indexing by 4 bytes instead of 3?

I am trying to send rendering information for an instancing rendering using shader buffer objects. My current problem is that I have 2 shader buffer objects, one which works just fine, and another ...
Makogan's user avatar
  • 1,696