- use in/out instead of attribute/varying - use named output instead of gl_FragColor - use texture() instead of the multitude of older texture sampling functions The #if __VERSION__ == 120 paths (needed on Mac) will be removed after we switch to 3.3 core profile. Part of T49165 (general OpenGL upgrade)
26 lines
478 B
GLSL
26 lines
478 B
GLSL
|
|
#if __VERSION__ == 120
|
|
varying vec3 coords;
|
|
#define fragColor gl_FragColor
|
|
#else
|
|
in vec3 coords;
|
|
out vec4 fragColor;
|
|
#define texture1D texture
|
|
#define texture3D texture
|
|
#endif
|
|
|
|
uniform sampler3D flame_texture;
|
|
uniform sampler1D spectrum_texture;
|
|
|
|
void main()
|
|
{
|
|
float flame = texture3D(flame_texture, coords).r;
|
|
vec4 emission = texture1D(spectrum_texture, flame);
|
|
|
|
vec4 color;
|
|
color.rgb = emission.a * emission.rgb;
|
|
color.a = emission.a;
|
|
|
|
fragColor = color;
|
|
}
|