forked from phaserjs/phaser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRenderTextureWebGL.js
More file actions
38 lines (32 loc) · 1.09 KB
/
Copy pathRenderTextureWebGL.js
File metadata and controls
38 lines (32 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
var RenderTextureWebGL = {
fill: function (rgb)
{
var ur = ((rgb >> 16)|0) & 0xff;
var ug = ((rgb >> 8)|0) & 0xff;
var ub = (rgb|0) & 0xff;
this.renderer.setFramebuffer(this.framebuffer);
var gl = this.gl;
gl.clearColor(ur / 255.0, ug / 255.0, ub / 255.0, 1);
gl.clear(gl.COLOR_BUFFER_BIT);
this.renderer.setFramebuffer(null);
return this;
},
clear: function ()
{
this.renderer.setFramebuffer(this.framebuffer);
var gl = this.gl;
gl.clearColor(0, 0, 0, 0);
gl.clear(gl.COLOR_BUFFER_BIT);
this.renderer.setFramebuffer(null);
return this;
},
draw: function (texture, frame, x, y)
{
var glTexture = texture.source[frame.sourceIndex].glTexture;
this.renderer.setFramebuffer(this.framebuffer);
this.renderer.pipelines.TextureTintPipeline.drawTexture(glTexture, x, y, frame.x, frame.y, frame.width, frame.height, this.currentMatrix);
this.renderer.setFramebuffer(null);
return this;
}
};
module.exports = RenderTextureWebGL;