Skip to content

Commit cb0060b

Browse files
committed
Remove culling and use bufferData instead of bufferSubData
1 parent 45069a9 commit cb0060b

File tree

3 files changed

+4
-15
lines changed

3 files changed

+4
-15
lines changed

Diff for: cocos2d/core/renderer/RendererWebGL.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -308,13 +308,11 @@ return {
308308
var _bufferchanged = !gl.bindBuffer(gl.ARRAY_BUFFER, _quadVertexBuffer);
309309
// upload the vertex data to the gl buffer
310310
if (_batchingSize > _vertexSize * 0.5) {
311-
if (_IS_IOS) gl.bufferData(gl.ARRAY_BUFFER, _vertexDataF32, gl.DYNAMIC_DRAW);
312-
else gl.bufferSubData(gl.ARRAY_BUFFER, 0, _vertexDataF32);
311+
gl.bufferData(gl.ARRAY_BUFFER, _vertexDataF32, gl.DYNAMIC_DRAW);
313312
}
314313
else {
315314
var view = _vertexDataF32.subarray(0, _batchingSize * _sizePerVertex);
316-
if (_IS_IOS) gl.bufferData(gl.ARRAY_BUFFER, view, gl.DYNAMIC_DRAW);
317-
else gl.bufferSubData(gl.ARRAY_BUFFER, 0, view);
315+
gl.bufferData(gl.ARRAY_BUFFER, view, gl.DYNAMIC_DRAW);
318316
}
319317

320318
if (_bufferchanged) {

Diff for: cocos2d/core/sprites/CCSpriteWebGLRenderCmd.js

+1-10
Original file line numberDiff line numberDiff line change
@@ -302,16 +302,6 @@
302302
if (!(locTexture && locTexture._textureLoaded && node._rect.width && node._rect.height) || !this._displayedOpacity)
303303
return false;
304304

305-
var vertices = this._vertices;
306-
var visibleRect = cc.view._visibleRect;
307-
var tl = vertices[0], bl = vertices[1], tr = vertices[2], br = vertices[3];
308-
if (Math.max(tl.x, bl.x, tr.x, br.x) < visibleRect.x ||
309-
Math.max(tl.y, bl.y, tr.y, br.y) < visibleRect.y ||
310-
Math.min(tl.x, bl.x, tr.x, br.x) > visibleRect.x + visibleRect.width ||
311-
Math.min(tl.y, bl.y, tr.y, br.y) > visibleRect.y + visibleRect.height) {
312-
return false;
313-
}
314-
315305
// Fill in vertex data with quad information (4 vertices for sprite)
316306
var opacity = this._displayedOpacity;
317307
var r = this._displayedColor.r,
@@ -324,6 +314,7 @@
324314
b *= a;
325315
}
326316

317+
var vertices = this._vertices;
327318
var i, len = vertices.length, vertex, offset = vertexDataOffset;
328319
for (i = 0; i < len; ++i) {
329320
offset = vertexDataOffset + i * 6;

Diff for: cocos2d/core/utils/CCProfiler.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cc.profiler = (function () {
22
var _showFPS = false;
3-
window._inited = false;
3+
var _inited = false;
44
var _frames = 0, _frameRate = 0, _lastSPF = 0, _accumDt = 0;
55
var _afterVisitListener = null,
66
_FPSLabel = document.createElement('div'),

0 commit comments

Comments
 (0)