diff options
author | Campbell Barton <ideasman42@gmail.com> | 2016-06-07 22:39:22 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2016-06-07 22:40:21 +0300 |
commit | 5bd9e832898221e5363150ee108655fd7f9c08a0 (patch) | |
tree | 80b71df4f7e358de302c304e04eb8708cbf2ee49 /source/blender/gpu/shaders | |
parent | 91c146c42e51676c71eea39342be932c150d5d45 (diff) |
GPU: Fix triple buffer w/ basic glsl shader
Needed to add GL_TEXTURE_RECTANGLE support to basic-shader.
Diffstat (limited to 'source/blender/gpu/shaders')
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_basic_frag.glsl | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_basic_frag.glsl b/source/blender/gpu/shaders/gpu_shader_basic_frag.glsl index 6b6679b60df..ea5f6aef005 100644 --- a/source/blender/gpu/shaders/gpu_shader_basic_frag.glsl +++ b/source/blender/gpu/shaders/gpu_shader_basic_frag.glsl @@ -3,6 +3,7 @@ * * USE_COLOR: use glColor for diffuse colors * USE_TEXTURE: use texture for diffuse colors + * USE_TEXTURE_RECTANGLE: use GL_TEXTURE_RECTANGLE instead of GL_TEXTURE_2D * USE_SCENE_LIGHTING: use lights (up to 8) * USE_SOLID_LIGHTING: assume 3 directional lights for solid draw mode * USE_TWO_SIDED: flip normal towards viewer @@ -39,8 +40,16 @@ varying vec4 varying_vertex_color; #endif #ifdef USE_TEXTURE +#ifdef USE_TEXTURE_RECTANGLE +#define sampler2D_default sampler2DRect +#define texture2D_default texture2DRect +#else +#define sampler2D_default sampler2D +#define texture2D_default texture2D +#endif + varying vec2 varying_texture_coord; -uniform sampler2D texture_map; +uniform sampler2D_default texture_map; #endif #ifdef USE_STIPPLE @@ -229,12 +238,12 @@ void main() float alpha; #if defined(USE_TEXTURE) && defined(USE_COLOR) - vec4 texture_color = texture2D(texture_map, varying_texture_coord); + vec4 texture_color = texture2D_default(texture_map, varying_texture_coord); L_diffuse *= texture_color.rgb * varying_vertex_color.rgb; alpha = texture_color.a * varying_vertex_color.a; #elif defined(USE_TEXTURE) - vec4 texture_color = texture2D(texture_map, varying_texture_coord); + vec4 texture_color = texture2D_default(texture_map, varying_texture_coord); L_diffuse *= texture_color.rgb; alpha = texture_color.a; @@ -259,9 +268,9 @@ void main() /* no lighting */ #if defined(USE_TEXTURE) && defined(USE_COLOR) - gl_FragColor = texture2D(texture_map, varying_texture_coord) * varying_vertex_color; + gl_FragColor = texture2D_default(texture_map, varying_texture_coord) * varying_vertex_color; #elif defined(USE_TEXTURE) - gl_FragColor = texture2D(texture_map, varying_texture_coord); + gl_FragColor = texture2D_default(texture_map, varying_texture_coord); #elif defined(USE_COLOR) gl_FragColor = varying_vertex_color; #else |