Merge pull request #2099 from 2youyou2/RenderTarget

fixed RenderTarget
This commit is contained in:
pandamicro
2017-11-15 10:30:53 +08:00
committed by GitHub
3 changed files with 6 additions and 2 deletions
@@ -386,7 +386,6 @@ _ccsg.Node.RenderCmd.prototype = {
visit: function (parentCmd) {
var node = this._node, renderer = cc.renderer;
parentCmd = parentCmd || this.getParentRenderCmd();
if (parentCmd) {
this._curLevel = parentCmd._curLevel + 1;
}
+3
View File
@@ -77,17 +77,20 @@ math.glFreeAll = function () {
math.glPushMatrix = function () {
cc.current_stack.push(cc.current_stack.top);
cc.current_stack.update();
};
math.glPushMatrixWitMat4 = function (saveMat) {
cc.current_stack.stack.push(cc.current_stack.top);
saveMat.assignFrom(cc.current_stack.top);
cc.current_stack.top = saveMat;
cc.current_stack.update();
};
math.glPopMatrix = function () {
//No need to lazy initialize, you shouldnt be popping first anyway!
cc.current_stack.top = cc.current_stack.stack.pop();
cc.current_stack.update();
};
math.glMatrixMode = function (mode) {
@@ -140,7 +140,6 @@ proto.initWithWidthAndHeight = function(width, height, format, depthStencilForma
var gl = cc._renderContext;
this._fullRect = new cc.Rect(0,0, width, height);
this._fullViewport = new cc.Rect(0,0, width, height);
width = 0 | width;
height = 0 | height;
@@ -158,6 +157,8 @@ proto.initWithWidthAndHeight = function(width, height, format, depthStencilForma
powH = misc.NextPOT(height);
}
this._fullViewport = new cc.Rect(0,0, powW, powH);
//void *data = malloc(powW * powH * 4);
var dataLen = powW * powH * 4;
var data = new Uint8Array(dataLen);
@@ -244,6 +245,7 @@ proto.begin = function(){
var orthoMatrix = cc.math.Matrix4.createOrthographicProjection(-1.0 / widthRatio, 1.0 / widthRatio,
-1.0 / heightRatio, 1.0 / heightRatio, -1, 1);
cc.math.glMatrixMode(cc.math.KM_GL_PROJECTION);
cc.math.glMultMatrix(orthoMatrix);
//calculate viewport