SHARE
TWEET

Untitled

a guest Mar 26th, 2019 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.     );
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top