Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1);
  2. const data = new Uint8Array([
  3. 255, 64, 192,
  4. 0, 192, 0
  5. ]);
  6.  
  7. let texture = gl.createTexture();
  8. gl.bindTexture(gl.TEXTURE_2D, texture);
  9. gl.texImage2D(gl.TEXTURE_2D,
  10. 0,
  11. gl.R8,
  12. 3,
  13. 2,
  14. 0,
  15. gl.RED,
  16. gl.UNSIGNED_BYTE,
  17. data);
  18.  
  19. gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
  20. gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
  21. gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
  22. gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
  23.  
  24. gl.activeTexture(gl.TEXTURE0);
  25. gl.bindTexture(gl.TEXTURE_2D, texture);
  26.  
  27. uniform sampler2D u_texture;
  28.  
  29. void main() {
  30. vec2 trans = texelFetch(u_texture, ivec2(0, 0), 0);
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement