Top "Shader" questions

A shader is a program to perform calculations on geometry or pixel data in computer graphics.

How to pass uniform array of struct to shader via C++ code

for eg. in FragmentShader:- struct LightSource { int Type; vec3 Position; vec3 Attenuation; vec3 Direction; vec3 Color; }; uniform LightSource Light[4]; …

opengl opengl-es shader
Learning modern OpenGL

I am aware that there were similar questions in past few years, but after doing some researches I still can't …

c++ opengl shader opengl-4
how to set a boolean property in unity3d CGprogram shader?

I am writing a shader for unity3d and I want to specify the properties of the shader in i.…

opengl unity3d shader cg
Gaussian Blur - standard deviation, radius and kernel size

I've implemented a gaussian blur fragment shader in GLSL. I understand the main concepts behind all of it: convolution, separation …

image-processing glsl shader gaussian fragment-shader
What does glUseProgram(0) do?

The OpenGL docs for glUseProgram claim that calling it with an argument of zero will cause the results of shader …

api opengl shader
Direct3D Line thickness

How do I change the thickness of lines when drawing line lists using Direct3D? This post says that line …

graphics directx direct3d shader
Shader optimization: Is a ternary operator equivalent to branching?

I'm working on a vertex shader in which I want to conditionally drop some vertices: float visible = texture(VisibleTexture, index).…

optimization graphics shader
OpenGL 4.x learning resources

I know there are some question about learning OpenGL. Here is what I know: math for 3D 3D theory Here …

opengl shader opengl-3 opengl-4
Why it is necessary to set precision for the fragment shader?

I learn WebGL. Next shaders work fine: // vertex.shader // precision mediump float; attribute vec4 a_Position; attribute float a_PointSize; …

opengl-es webgl shader precision
Shader can't be compiled

I'm following book "OpenGL Programming Guide 8th Edition". I just want to run the first program introduced in the book …

opengl shader glut osx-mavericks