From: Mikko Rasa Date: Wed, 16 Jan 2013 17:04:20 +0000 (+0200) Subject: Fix shaders in the desertpillars demo X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=73ab6382709fa2c9a30f196e462e8f60f7f4beda;p=libs%2Fgl.git Fix shaders in the desertpillars demo --- diff --git a/demos/desertpillars.cpp b/demos/desertpillars.cpp index 61db0bad..0f148f7d 100644 --- a/demos/desertpillars.cpp +++ b/demos/desertpillars.cpp @@ -202,11 +202,12 @@ const char DesertPillars::texture_fragment_src[] = "}\n"; const char DesertPillars::skybox_vertex_src[] = + "#version 120\n" "varying vec3 v_texcoord;\n" "void main()\n" "{\n" " gl_Position = gl_ProjectionMatrix*vec4(mat3(gl_ModelViewMatrix)*gl_Vertex.xyz, 1.0);\n" - " v_texcoord = gl_Vertex;\n" + " v_texcoord = gl_Vertex.xyz;\n" "}"; const char DesertPillars::skybox_fragment_src[] = @@ -239,11 +240,11 @@ const char DesertPillars::ground_colorify_src[] = "varying float v_ground_type;\n" "vec4 sample_texture(vec2 coord)\n" "{\n" - " return mix(texture2D(texture1, coord*3), texture2D(texture2, coord), v_ground_type);\n" + " return mix(texture2D(texture1, coord*3.0), texture2D(texture2, coord), v_ground_type);\n" "}\n" "vec3 sample_normalmap(vec2 coord)\n" "{\n" - " return mix(texture2D(normalmap1, coord*3), texture2D(normalmap2, coord), v_ground_type);\n" + " return mix(texture2D(normalmap1, coord*3.0).rgb, texture2D(normalmap2, coord).rgb, v_ground_type);\n" "}\n"; const char DesertPillars::cube_transform_src[] = @@ -251,7 +252,7 @@ const char DesertPillars::cube_transform_src[] = "attribute vec3 sphere_coord;\n" "vec4 transform_vertex(vec4 vertex)\n" "{\n" - " return gl_ModelViewMatrix*vec4(mix(vertex, sphere_coord, spherify), 1.0);\n" + " return gl_ModelViewMatrix*vec4(mix(vertex.xyz, sphere_coord, spherify), 1.0);\n" "}\n" "vec3 transform_normal(vec3 normal)\n" "{\n"