Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2020
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.46 KB | None | 0 0
  1. local colourRemover = Shader()
  2. colourRemover:compileFromFile(nil,Misc.resolveFile("flip.frag"))
  3.  
  4. local playerBuffer = Graphics.CaptureBuffer(800,600)
  5. local bgBuffer     = Graphics.CaptureBuffer(800,600)
  6. function oag.onDraw()
  7.     bgBuffer:captureAt(-100)
  8.  
  9.     Graphics.drawBox{x=0,y=0,width=800,height=800,priority=-100,color={1,0,0.8627,1}}
  10.  
  11.     player:render{
  12.         x = 400-(player.width/2),y = 300-(player.height/2),
  13.         sceneCoords = false,priority = -100,
  14.     }
  15.  
  16.     playerBuffer:captureAt(-100)
  17.  
  18.     local x,y = 0,0
  19.  
  20.     Graphics.glDraw{
  21.         texture = playerBuffer,
  22.         vertexCoords = {
  23.             x    ,y+600,
  24.             x+800,y+600,
  25.             x    ,y    ,
  26.             x+800,y    ,
  27.         },
  28.         textureCoords = {
  29.             (0),(0),
  30.             (1),(0),
  31.             (0),(1),
  32.             (1),(1),
  33.         },
  34.         primitive = Graphics.GL_TRIANGLE_STRIP,
  35.         priority = -25,shader = colourRemover,
  36.         uniforms = {
  37.             keyColor = {1,0,0.8627,1},
  38.             threshold = 1.5/255,
  39.         },
  40.     }
  41.  
  42.     Graphics.glDraw{
  43.         texture = bgBuffer,
  44.         vertexCoords = {
  45.             x    ,y    ,
  46.             x+800,y    ,
  47.             x    ,y+600,
  48.             x+800,y+600,
  49.         },
  50.         textureCoords = {
  51.             (0),(0),
  52.             (1),(0),
  53.             (0),(1),
  54.             (1),(1),
  55.         },
  56.         primitive = Graphics.GL_TRIANGLE_STRIP,
  57.         priority = -100,
  58.     }
  59. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement