Advertisement
Guest User

Untitled

a guest
Mar 26th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.79 KB | None | 0 0
  1. /******************************
  2. *
  3. * MACRO FOR HAVING LONG STRINGS
  4. *
  5. ******************************/
  6. #ifndef GLSL
  7. #define GLSL(version,A) "#version " #version "\n" #A
  8. #endif
  9.  
  10.  
  11.  
  12.  
  13. /******************************
  14. *
  15. * EXAMPLE OF USING MACRO
  16. *
  17. ******************************/
  18.  
  19. const char * vert =  GLSL(120,
  20.      
  21.       attribute vec4 position;
  22.       attribute vec4 color;
  23.  
  24.       varying vec4 dstColor;
  25.  
  26.       uniform mat4 ortho;                //<-- new uniform matrix
  27.  
  28.       void main(){
  29.         dstColor = color;
  30.         gl_Position = ortho * position;  //<-- matrix gets multiplied by the position
  31.       }
  32.  
  33.     );
  34.    
  35.  
  36.  
  37.  
  38. const char * frag =  GLSL(120,
  39.      
  40.       varying vec4 dstColor;
  41.        
  42.       void main(){
  43.         gl_FragColor = dstColor;
  44.       }
  45.  
  46.     );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement