Home | History | Annotate | Download | only in libopengltest
      1 /*
      2  * Copyright (C) 2012 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 #ifndef _SHADER_H_
     17 #define _SHADER_H_
     18 
     19 static const char attach_shader_successful_complile_shader[] =
     20            "attribute vec3 gtf_Normal;\n"
     21             "attribute vec4 gtf_Vertex;\n"
     22             "uniform mat3 gtf_NormalMatrix;\n"
     23             "uniform mat4 gtf_ModelViewMatrix;\n"
     24             "uniform mat4 gtf_ModelViewProjectionMatrix;\n"
     25 
     26             "varying float lightIntensity;\n"
     27             "varying vec3 Position;\n"
     28             "uniform vec3 LightPosition;\n"
     29             "uniform float Scale;\n"
     30             "void main(void) {\n"
     31             "vec4 pos = gtf_ModelViewMatrix * gtf_Vertex;\n"
     32             "Position = vec3(gtf_Vertex) * Scale;\n"
     33             "vec3 tnorm = normalize(gtf_NormalMatrix * gtf_Normal);\n"
     34             "lightIntensity = dot(normalize(LightPosition - vec3(pos)), tnorm) * 1.5;\n"
     35             "gl_Position = gtf_ModelViewProjectionMatrix * gtf_Vertex;\n";
     36 
     37 static const char color_one_fragment_shader_one[] =
     38         "precision mediump float;     \n"
     39         "varying vec4 varyColor;      \n"
     40         "void main()                  \n"
     41         "{                            \n"
     42         "  gl_FragColor = varyColor;  \n"
     43         "}       ";
     44 
     45 static const char color_one_fragment_shader[] =
     46         "precision mediump float;     \n"
     47         "void main()                  \n"
     48         "{                            \n"
     49         "  gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);  \n"
     50         "}       ";
     51 
     52 #endif
     53