PanoramaViewer
 All Classes Namespaces Files Functions Variables Macros Pages
simpleShaders.h
Go to the documentation of this file.
1 #ifndef SIMPLESHADERS_H_
2 #define SIMPLESHADERS_H_
3 
4 #include <string>
5 
6 using namespace std;
7 
8 //Codigo da funcao do Vertex Shader
9 static const char texturedVertexShader[] =
10  "attribute vec4 position; \n"
11  "attribute vec2 textureCoordinates; \n"
12  "uniform mat4 projectionMatrix;\n"
13  "uniform mat4 modelMatrix; \n"
14  "uniform mat4 viewMatrix; \n"
15  "varying vec2 v_textureCoordinates; \n"
16  "void main() \n"
17  "{ \n"
18  " gl_Position = projectionMatrix*(modelMatrix*(viewMatrix*position)); \n"
19  " v_textureCoordinates = textureCoordinates; \n"
20  "} \n";
21 
22 //Codigo da funcao do Fragment shader
23 static const char texturedFragmentShader[] =
24  "precision mediump float; \n"
25  "varying vec2 v_textureCoordinates; \n"
26  "uniform sampler2D s_texture; \n"
27  "void main() \n"
28  "{ \n"
29  " gl_FragColor = texture2D(s_texture, v_textureCoordinates); \n"
30  "} \n";
31 
32 
33 static const string colorizedVertexShader =
34  "attribute vec4 position; \n"
35  "uniform mat4 projectionMatrix;\n"
36  "uniform mat4 modelViewMatrix; \n"
37  "uniform vec4 color; \n"
38  "varying vec4 v_color; \n"
39  "void main() \n"
40  "{ \n"
41  " gl_Position = projectionMatrix*(modelViewMatrix*position); \n"
42  " v_color = color; \n"
43  "} \n";
44 
45 static const string colorizedFragmentShader =
46  "precision mediump float; \n"
47  "varying vec4 v_color; \n"
48  "void main() \n"
49  "{ \n"
50  " gl_FragColor = v_color; \n"
51  "} \n";
52 
53 static char simpleVShaderStr[] =
54 "attribute vec4 vPosition;\n"
55 "uniform mat4 projectionMatrix;\n"
56 "void main()\n"
57 "{\n"
58  "gl_Position = position; \n"
59 "}\n";
60 
61 
62 static char simpleFShaderStr[] =
63 "precision mediump float;\n"
64 "void main()\n"
65 "{\n"
66 " gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); \n"
67 "}\n";
68 
69 
70 GLubyte transparente[] =
71  { 128, 0, 0, 128, 0, 128, 0, 128, 0, 0, 128, 128, 128, 128, 0, 128,
72  128, 0, 0, 128, 0, 128, 0, 128, 0, 0, 128, 128, 128, 128, 0, 128,
73  128, 0, 0, 128, 0, 128, 0, 128, 0, 0, 128, 128, 128, 128, 0, 128,
74  128, 0, 0, 128, 0, 128, 0, 128, 0, 0, 128, 128, 128, 128, 0, 128,
75  128, 0, 0, 128, 0, 128, 0, 128, 0, 0, 128, 128, 128, 128, 0, 128,
76  128, 0, 0, 128, 0, 128, 0, 128, 0, 0, 128, 128, 128, 128, 0, 128,
77  128, 0, 0, 128, 0, 128, 0, 128, 0, 0, 128, 128, 128, 128, 0, 128,
78  128, 0, 0, 128, 0, 128, 0, 128, 0, 0, 128, 128, 128, 128, 0, 128,
79  128, 0, 0, 128, 0, 128, 0, 128, 0, 0, 128, 128, 128, 128, 0, 128,
80  128, 0, 0, 128, 0, 128, 0, 128, 0, 0, 128, 128, 128, 128, 0, 128,
81  128, 0, 0, 128, 0, 128, 0, 128, 0, 0, 128, 128, 128, 128, 0, 128,
82  128, 0, 0, 128, 0, 128, 0, 128, 0, 0, 128, 128, 128, 128, 0, 128,
83  128, 0, 0, 128, 0, 128, 0, 128, 0, 0, 128, 128, 128, 128, 0, 128,
84  128, 0, 0, 128, 0, 128, 0, 128, 0, 0, 128, 128, 128, 128, 0, 128,
85  128, 0, 0, 128, 0, 128, 0, 128, 0, 0, 128, 128, 128, 128, 0, 128,
86  128, 0, 0, 128, 0, 128, 0, 128, 0, 0, 128, 128, 128, 128, 0, 128
87  };
88 
89 
90 #endif /* SHADERS_H_ */