1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | FRAGMENT SHADER ------------------------ in vec2 texture_coordinate; //Main Entry Point void main(void){ //To Tell GLSL The Texture and Texture Coords texture cords is the position gl_FragColor = texture(texture, texture_coord); //vec4(1.0, 0.0, 0.0, 1.0); //gl_FragColor = vec4(texture_coordinate.xy, 0.0, 1.0); } VERTEX SHADER ------------------------ #version 150 //Always use a attribute vec4 for position variable in vec4 position; //Matrix 3 x 3 row //mat4 projection; //Texture Cordinates 2 element vector of varying type //attribute vec2 texture_coordinate; in vec2 texture_coordinate; out vec2 texture_coord; //Translations 3 element vector uniform uniform vec3 translations; //Projection Matrix //mat4 projection = mat4( // vec4(1.0, 0.0, 0.0, 0.0), // vec4(0.0, 1.0, 0.0, 0.0), // vec4(0.0, 0.0, 1.0, 0.0), // vec4(0.0, 0.0, 0.0, 1.0)); //Main Entry Point void main() { //Passing The Texture Coordinate of Texture Unit 0 To The Fragment Shader texture_coord = (texture_coordinate); // To Put The Vertex in View? //ORGINALLY 8.0 gl_Position = vec4(position.xyz + translations.xyz, 1.0); } |
CkZSQUdNRU5UIFNIQURFUgotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KCmluIHZlYzIgdGV4dHVyZV9jb29yZGluYXRlOwoKLy9NYWluIEVudHJ5IFBvaW50CnZvaWQgbWFpbih2b2lkKXsKCgogICAgIAogIAoKICAgLy9UbyBUZWxsIEdMU0wgVGhlIFRleHR1cmUgYW5kIFRleHR1cmUgQ29vcmRzICB0ZXh0dXJlIGNvcmRzIGlzIHRoZSBwb3NpdGlvbgogICBnbF9GcmFnQ29sb3IgPSB0ZXh0dXJlKHRleHR1cmUsIHRleHR1cmVfY29vcmQpOwogICAKICAgLy92ZWM0KDEuMCwgMC4wLCAwLjAs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Y29vcmQgPSAodGV4dHVyZV9jb29yZGluYXRlKTsKCgogIAoKICAvLyBUbyBQdXQgVGhlIFZlcnRleCBpbiBWaWV3PyAvL09SR0lOQUxMWSA4LjAKIGdsX1Bvc2l0aW9uID0gdmVjNChwb3NpdGlvbi54eXogKyB0cmFuc2xhdGlvbnMueHl6LCAxLjApOwoKIAogIAp9Cg==
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
-
result: Compilation error (maybe you wish to see an example for C++ 4.7.2)


