Guest User

Untitled

a guest
Apr 22nd, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. // Simple vertex shader
  2. private static final String VERTEX_SHADER =
  3. "uniform mat4 uMVPMatrix;\n" +
  4. "uniform mat4 uTexMatrix;\n" +
  5. "attribute vec4 aPosition;\n" +
  6. "attribute vec4 aTextureCoord;\n" +
  7. "varying vec2 vTextureCoord;\n" +
  8. "void main() {\n" +
  9. " gl_Position = uMVPMatrix * aPosition;\n" +
  10. " vTextureCoord = (uTexMatrix * aTextureCoord).xy;\n" +
  11. "}\n";
  12.  
  13. // Fragment shader for use with external 2D textures + an lut texture
  14. private static final String FRAGMENT_SHADER_EXT =
  15. "" +
  16. "#extension GL_OES_EGL_image_external : require\n" +
  17. "precision mediump float;\n" +
  18. "varying vec2 vTextureCoord;\n" +
  19. "uniform samplerExternalOES sTexture;\n" +
  20. "uniform sampler2D lutTexture;\n" +
  21. "void main() {\n" +
  22. " float lum = texture2D(sTexture, vTextureCoord).r;" +
  23. " lum = clamp(lum, 0.0, 1.0);" +
  24. " gl_FragColor = texture2D(lutTexture, vec2(lum, 0.5));\n" +
  25. "}\n";
Add Comment
Please, Sign In to add comment