Search
lxdream.org :: lxdream/src/pvr2/shaders.glsl :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/pvr2/shaders.glsl
changeset 1240:190df8a791ca
prev1232:e5b12e2fe6ba
next1250:204dae47ab7a
author nkeynes
date Tue Feb 28 17:25:26 2012 +1000 (8 years ago)
permissions -rw-r--r--
last change Implement display output for the GLES2 case (no fixed function
rendering)
file annotate diff log raw
1.1 --- a/src/pvr2/shaders.glsl Thu Feb 23 22:20:15 2012 +1000
1.2 +++ b/src/pvr2/shaders.glsl Tue Feb 28 17:25:26 2012 +1000
1.3 @@ -63,7 +63,7 @@
1.4 * float gl_FragDepth;
1.5
1.6 */
1.7 -
1.8 +#include "../config.h"
1.9
1.10 #vertex DEFAULT_VERTEX_SHADER
1.11 uniform mat4 view_matrix;
1.12 @@ -130,3 +130,36 @@
1.13 }
1.14
1.15 #program pvr2_shader = DEFAULT_VERTEX_SHADER DEFAULT_FRAGMENT_SHADER
1.16 +
1.17 +#ifndef HAVE_OPENGL_FIXEDFUNC
1.18 +/* In this case we also need a basic shader to actually display the output */
1.19 +#vertex BASIC_VERTEX_SHADER
1.20 +uniform mat4 view_matrix;
1.21 +attribute vec2 in_vertex;
1.22 +attribute vec4 in_colour;
1.23 +attribute vec2 in_texcoord; /* uv = coord, z = palette, w = mode */
1.24 +
1.25 +varying vec4 frag_colour;
1.26 +varying vec2 frag_texcoord;
1.27 +void main()
1.28 +{
1.29 + gl_Position = view_matrix * vec4(in_vertex.x,in_vertex.y,0,1);
1.30 + frag_colour = in_colour;
1.31 + frag_texcoord = in_texcoord;
1.32 +}
1.33 +
1.34 +#fragment BASIC_FRAGMENT_SHADER
1.35 +
1.36 +uniform sampler2D primary_texture;
1.37 +varying vec4 frag_colour;
1.38 +varying vec2 frag_texcoord;
1.39 +
1.40 +void main()
1.41 +{
1.42 + vec4 tex = texture2D( primary_texture, frag_texcoord.xy );
1.43 + gl_FragColor.rgb = mix( frag_colour.rgb, tex.rgb, frag_colour.a );
1.44 + gl_FragDepth = gl_FragCoord.z;
1.45 +}
1.46 +
1.47 +#program basic_shader = BASIC_VERTEX_SHADER BASIC_FRAGMENT_SHADER
1.48 +#endif
.