Top "Shader" questions

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

Constant float values in GLSL shaders - any reason to use uniforms?

I'm looking at the source of an OpenGL application that uses shaders. One particular shader looks like this: uniform float …

opengl glsl constants shader
OpenGL ES 2.0 Shader best practices

I've been searching for examples of shaders in OpenGL and I've seen some varying styles. Some shaders specifically use the …

opengl-es glsl shader
Speed of cos() and sin() function in GLSL shaders?

I'm interested in information about the speed of sin() and cos() in Open GL Shader Language. The GLSL Specification Document …

optimization opengl glsl shader jogl
WebGL/GLSL - How does a ShaderToy work?

I've been knocking around Shadertoy - https://www.shadertoy.com/ - recently, in an effort to learn more about OpenGL …

javascript glsl webgl shader pixel-shader
OpenGL - How to access depth buffer values? - Or: gl_FragCoord.z vs. Rendering depth to texture

I want to access the depth buffer value at the currently processed pixel in a pixel shader. How can we …

opengl glsl shader fragment-shader
Why does my OpenGL Phong shader behave like a flat shader?

I've been learning OpenGL for the past couple of weeks and I've run into some trouble implementing a Phong shader. …

opengl glsl shader pyopengl
draw the depth value in opengl using shaders

I want to draw the depth buffer in the fragment shader, I do this: Vertex shader: varying vec4 position_; gl_…

opengl shader
What is the relationship between gl_Color and gl_FrontColor in both vertex and fragment shaders

I have pass-through vertex and fragment shaders. vertex shader void main(void) { gl_TexCoord[0] = gl_MultiTexCoord0; gl_Position = gl_ModelViewProjectionMatrix * …

opengl shader pixel-shader vertex-shader
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 …

opengl glsl shader geometry-shader marching-cubes
"flat" qualifier in glsl?

So I was reading "The Official OpenGL Guide" and in a section where they taught material lighting, they suddenly used …

opengl glsl shader