fork download
  1.  
  2. FRAGMENT SHADER
  3. ------------------------
  4.  
  5. in vec2 texture_coordinate;
  6.  
  7. //Main Entry Point
  8. void main(void){
  9.  
  10.  
  11.  
  12.  
  13.  
  14. //To Tell GLSL The Texture and Texture Coords texture cords is the position
  15. gl_FragColor = texture(texture, texture_coord);
  16.  
  17. //vec4(1.0, 0.0, 0.0, 1.0);
  18. //gl_FragColor = vec4(texture_coordinate.xy, 0.0, 1.0);
  19.  
  20.  
  21.  
  22. }
  23.  
  24.  
  25. VERTEX SHADER
  26. ------------------------
  27. #version 150
  28.  
  29. //Always use a attribute vec4 for position variable
  30. in vec4 position;
  31.  
  32.  
  33. //Matrix 3 x 3 row
  34. //mat4 projection;
  35.  
  36.  
  37. //Texture Cordinates 2 element vector of varying type
  38.  
  39. //attribute vec2 texture_coordinate;
  40. in vec2 texture_coordinate;
  41.  
  42. out vec2 texture_coord;
  43. //Translations 3 element vector uniform
  44. uniform vec3 translations;
  45.  
  46.  
  47. //Projection Matrix
  48. //mat4 projection = mat4(
  49. // vec4(1.0, 0.0, 0.0, 0.0),
  50. // vec4(0.0, 1.0, 0.0, 0.0),
  51. // vec4(0.0, 0.0, 1.0, 0.0),
  52. // vec4(0.0, 0.0, 0.0, 1.0));
  53.  
  54.  
  55. //Main Entry Point
  56. void main()
  57. {
  58.  
  59.  
  60. //Passing The Texture Coordinate of Texture Unit 0 To The Fragment Shader
  61. texture_coord = (texture_coordinate);
  62.  
  63.  
  64.  
  65.  
  66. // To Put The Vertex in View? //ORGINALLY 8.0
  67. gl_Position = vec4(position.xyz + translations.xyz, 1.0);
  68.  
  69.  
  70.  
  71. }
  72.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:27:2: error: invalid preprocessing directive #version
prog.cpp:2: error: ‘FRAGMENT’ does not name a type
prog.cpp:8: error: ‘::main’ must return ‘int’
prog.cpp: In function ‘int main()’:
prog.cpp:15: error: ‘gl_FragColor’ was not declared in this scope
prog.cpp:15: error: ‘texture’ was not declared in this scope
prog.cpp:15: error: ‘texture_coord’ was not declared in this scope
prog.cpp:15: error: ‘texture’ was not declared in this scope
prog.cpp:15: error: declaration of ‘<typeprefixerror>texture’
prog.cpp:15: error: conflicts with previous declaration ‘<typeprefixerror>texture’
prog.cpp: At global scope:
prog.cpp:25: error: ‘VERTEX’ does not name a type
prog.cpp:40: error: ‘in’ does not name a type
prog.cpp:42: error: ‘out’ does not name a type
prog.cpp:44: error: ‘uniform’ does not name a type
prog.cpp:56: error: ‘::main’ must return ‘int’
prog.cpp: In function ‘int main()’:
prog.cpp:56: error: redefinition of ‘int main()’
prog.cpp:8: error: ‘int main()’ previously defined here
prog.cpp:61: error: ‘texture_coord’ was not declared in this scope
prog.cpp:61: error: ‘texture_coordinate’ was not declared in this scope
prog.cpp:67: error: ‘gl_Position’ was not declared in this scope
prog.cpp:67: error: ‘position’ was not declared in this scope
prog.cpp:67: error: ‘translations’ was not declared in this scope
prog.cpp:67: error: ‘vec4’ was not declared in this scope
stdout
Standard output is empty