mirror of
https://github.com/photonstorm/phaser
synced 2025-02-17 06:28:30 +00:00
Removed gl texture ID.
This commit is contained in:
parent
b254d085cd
commit
ea9c9ae7b3
9 changed files with 23 additions and 34 deletions
|
@ -66,7 +66,7 @@ Phaser.RenderTexture = function (game, width, height, key, scaleMode, resolution
|
|||
this.baseTexture = new PIXI.BaseTexture();
|
||||
this.baseTexture.width = this.width * this.resolution;
|
||||
this.baseTexture.height = this.height * this.resolution;
|
||||
this.baseTexture._glTextures = [];
|
||||
this.baseTexture._glTextures = null;
|
||||
this.baseTexture.resolution = this.resolution;
|
||||
|
||||
this.baseTexture.scaleMode = scaleMode;
|
||||
|
@ -90,7 +90,7 @@ Phaser.RenderTexture = function (game, width, height, key, scaleMode, resolution
|
|||
this.baseTexture._dirty[gl.id] = false;
|
||||
|
||||
this.textureBuffer = new PIXI.FilterTexture(gl, this.width, this.height, this.baseTexture.scaleMode, textureUnit);
|
||||
this.baseTexture._glTextures[gl.id] = this.textureBuffer.texture;
|
||||
this.baseTexture._glTextures = this.textureBuffer.texture;
|
||||
|
||||
this.projection = new Phaser.Point(this.width * 0.5, -this.height * 0.5);
|
||||
}
|
||||
|
|
|
@ -455,7 +455,7 @@ Phaser.Rope.prototype._renderStrip = function (renderSession) {
|
|||
else
|
||||
{
|
||||
// bind the current texture
|
||||
gl.bindTexture(gl.TEXTURE_2D, this.texture.baseTexture._glTextures[gl.id]);
|
||||
gl.bindTexture(gl.TEXTURE_2D, this.texture.baseTexture._glTextures);
|
||||
}
|
||||
|
||||
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer);
|
||||
|
@ -482,7 +482,7 @@ Phaser.Rope.prototype._renderStrip = function (renderSession) {
|
|||
}
|
||||
else
|
||||
{
|
||||
gl.bindTexture(gl.TEXTURE_2D, this.texture.baseTexture._glTextures[gl.id]);
|
||||
gl.bindTexture(gl.TEXTURE_2D, this.texture.baseTexture._glTextures);
|
||||
}
|
||||
|
||||
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer);
|
||||
|
|
|
@ -2002,7 +2002,7 @@ Phaser.Cache.prototype = {
|
|||
|
||||
for (var key in this._cache.image)
|
||||
{
|
||||
this._cache.image[key].base._glTextures = [];
|
||||
this._cache.image[key].base._glTextures = null;
|
||||
}
|
||||
|
||||
},
|
||||
|
|
|
@ -81,7 +81,7 @@ PIXI.BaseTexture = function(source, scaleMode)
|
|||
* @type Array
|
||||
* @private
|
||||
*/
|
||||
this._glTextures = [];
|
||||
this._glTextures = null;
|
||||
|
||||
/**
|
||||
* Set this to true if a mipmap of this texture needs to be generated. This value needs to be set before the texture is used
|
||||
|
@ -194,10 +194,7 @@ PIXI.BaseTexture.prototype.updateSourceImage = function(newSrc)
|
|||
*/
|
||||
PIXI.BaseTexture.prototype.dirty = function()
|
||||
{
|
||||
for (var i = 0; i < this._glTextures.length; i++)
|
||||
{
|
||||
this._dirty[i] = true;
|
||||
}
|
||||
this._dirty = true;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -208,22 +205,9 @@ PIXI.BaseTexture.prototype.dirty = function()
|
|||
*/
|
||||
PIXI.BaseTexture.prototype.unloadFromGPU = function()
|
||||
{
|
||||
this.dirty();
|
||||
|
||||
// delete the webGL textures if any.
|
||||
for (var i = this._glTextures.length - 1; i >= 0; i--)
|
||||
{
|
||||
var glTexture = this._glTextures[i];
|
||||
var gl = PIXI.glContexts[i];
|
||||
|
||||
if(gl && glTexture)
|
||||
{
|
||||
gl.deleteTexture(glTexture);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
this._glTextures.length = 0;
|
||||
// gl.deleteTexture(this._glTextures);
|
||||
|
||||
this._glTextures = null;
|
||||
|
||||
this.dirty();
|
||||
};
|
||||
|
|
|
@ -12,8 +12,6 @@ Phaser.Renderer.Canvas.GameObjects.Graphics = {
|
|||
|
||||
render: function (renderer, src)
|
||||
{
|
||||
return;
|
||||
|
||||
var context = renderer.context;
|
||||
|
||||
if (this.dirty)
|
||||
|
|
|
@ -57,6 +57,8 @@ Phaser.Renderer.WebGL.FilterManager.prototype = {
|
|||
{
|
||||
this.gl = this.renderer.gl;
|
||||
|
||||
var gl = this.gl;
|
||||
|
||||
this.texturePool = [];
|
||||
|
||||
// Initialises the shader buffers
|
||||
|
@ -112,7 +114,7 @@ Phaser.Renderer.WebGL.FilterManager.prototype = {
|
|||
{
|
||||
this.defaultShader = this.renderer.shaderManager.defaultShader;
|
||||
|
||||
var projection = this.this.renderer.projection;
|
||||
var projection = this.renderer.projection;
|
||||
|
||||
this.width = projection.x * 2;
|
||||
this.height = -projection.y * 2;
|
||||
|
|
|
@ -63,7 +63,7 @@ Phaser.Renderer.WebGL.ShaderManager.prototype = {
|
|||
this.primitiveShader = new Phaser.Renderer.WebGL.Shaders.PrimitiveGraphics(this.renderer);
|
||||
|
||||
// the next one is used by the stencil buffer manager when Graphics.mode = 1
|
||||
this.complexPrimitiveShader = new Phaser.Renderer.WebGL.Shaders.ComplexPrimitiveGraphics(this);
|
||||
this.complexPrimitiveShader = new Phaser.Renderer.WebGL.Shaders.ComplexPrimitiveGraphics(this.renderer);
|
||||
|
||||
this.setShader(this.defaultShader);
|
||||
},
|
||||
|
|
|
@ -130,13 +130,13 @@ Phaser.Renderer.WebGL.SpriteBatch.prototype = {
|
|||
]);
|
||||
}
|
||||
|
||||
// create a couple of buffers
|
||||
// Create a couple of buffers
|
||||
this.vertexBuffer = gl.createBuffer();
|
||||
this.indexBuffer = gl.createBuffer();
|
||||
|
||||
// 65535 is max index, so 65535 / 6 = 10922.
|
||||
// 65535 is max index, so 65535 / 6 = 10922.
|
||||
|
||||
//upload the index data
|
||||
// Upload the index data
|
||||
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.indexBuffer);
|
||||
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this.indices, gl.STATIC_DRAW);
|
||||
|
||||
|
|
|
@ -192,6 +192,11 @@ Phaser.Renderer.WebGL.prototype = {
|
|||
{
|
||||
var types = Phaser.Renderer.WebGL.GameObjects[renderer].TYPES;
|
||||
|
||||
if (!types)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for (var i = 0; i < types.length; i++)
|
||||
{
|
||||
types[i].render = Phaser.Renderer.WebGL.GameObjects[renderer].render;
|
||||
|
@ -397,7 +402,7 @@ Phaser.Renderer.WebGL.prototype = {
|
|||
|
||||
this.spriteBatch.begin();
|
||||
|
||||
// this.filterManager.begin();
|
||||
this.filterManager.begin();
|
||||
|
||||
stage.render(this, stage);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue