]> git.tdb.fi Git - libs/gl.git/commitdiff
Fix shaders in the desertpillars demo
authorMikko Rasa <tdb@tdb.fi>
Wed, 16 Jan 2013 17:04:20 +0000 (19:04 +0200)
committerMikko Rasa <tdb@tdb.fi>
Wed, 16 Jan 2013 17:04:20 +0000 (19:04 +0200)
demos/desertpillars.cpp

index 61db0badcf8e0b1756f306ce4e1028bb77212f0b..0f148f7de28ebc4335eff4bef2bea967de51ab5d 100644 (file)
@@ -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"