Fix supportsNPOT and ignore contentSize in Texture.initWithData

This commit is contained in:
pandamicro
2018-02-01 15:28:00 +08:00
parent 03671db549
commit fe867cd95b
3 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -244,7 +244,7 @@ cc.configuration = /** @lends cc.configuration# */{
this._supportsPVRTC = this.checkForGLExtension("GL_IMG_texture_compression_pvrtc");
locValueDict["gl.supports_PVRTC"] = this._supportsPVRTC;
this._supportsNPOT = false; //true;
this._supportsNPOT = true;
locValueDict["gl.supports_NPOT"] = this._supportsNPOT;
this._supportsBGRA8888 = this.checkForGLExtension("GL_IMG_texture_format_BGRA888");
+3 -3
View File
@@ -352,7 +352,7 @@ var Texture2D = cc.Class(/** @lends cc.Texture2D# */{
* @param {Number} pixelFormat
* @param {Number} pixelsWidth
* @param {Number} pixelsHeight
* @param {Size} contentSize
* @param {Size} contentSize contentSize is deprecated and ignored
* @return {Boolean}
*/
initWithData: function (data, pixelFormat, pixelsWidth, pixelsHeight, contentSize) {
@@ -860,8 +860,8 @@ game.once(game.EVENT_RENDERER_INITED, function () {
opts.width = pixelsWidth;
opts.height = pixelsHeight;
this.update(opts);
this.width = contentSize.width;
this.height = contentSize.height;
this.width = pixelsWidth;
this.height = pixelsHeight;
this.loaded = true;
this.emit("load");
return true;
@@ -172,7 +172,7 @@ proto.initWithWidthAndHeight = function(width, height, format, depthStencilForma
if (!node._texture)
return false;
locTexture.initWithData(data, node._pixelFormat, powW, powH, cc.size(width, height));
locTexture.initWithData(data, node._pixelFormat, powW, powH);
//free( data );
var oldRBO = gl.getParameter(gl.RENDERBUFFER_BINDING);
@@ -181,7 +181,7 @@ proto.initWithWidthAndHeight = function(width, height, format, depthStencilForma
this._textureCopy = new cc.Texture2D();
if (!this._textureCopy)
return false;
this._textureCopy.initWithData(data, node._pixelFormat, powW, powH, cc.size(width, height));
this._textureCopy.initWithData(data, node._pixelFormat, powW, powH);
}
// generate FBO