Skip to content

Commit

Permalink
Merge pull request cedricpinson#1000 from cedricpinson/rtt-dirty-tex
Browse files Browse the repository at this point in the history
Fixes RTT texture dirty check (e.g: resizing rtt)
  • Loading branch information
cedricpinson authored Sep 6, 2018
2 parents a174d26 + eaa0cab commit cbd96c7
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions sources/osg/FrameBufferObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,13 +337,21 @@ utils.createPrototypeStateAttribute(
var attachments = this._attachments;

// ?
if (attachments.length === 0 && !this._fbo) {
var nbAttachments = attachments.length;
if (nbAttachments === 0 && !this._fbo) {
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
return;
}

var i = 0;

// each frame
if (!this.isDirty()) {
for (i = 0; i < nbAttachments; ++i) {
var tex = attachments[i].texture;
if (tex) tex.apply(state);
}

gl.bindFramebuffer(gl.FRAMEBUFFER, this._fbo);
if (notify.reportWebGLError === true) this.checkStatus();
return;
Expand All @@ -358,7 +366,7 @@ utils.createPrototypeStateAttribute(
var bufs = this._hasMRT ? this._buffers : undefined;
var hasRenderBuffer = false;

for (var i = 0, l = attachments.length; i < l; ++i) {
for (i = 0; i < nbAttachments; ++i) {
var attachment = attachments[i];

// render buffer
Expand Down

0 comments on commit cbd96c7

Please sign in to comment.