Skip to content

Commit

Permalink
fix debug mode not visible when using post processing plugin
Browse files Browse the repository at this point in the history
do not hide 2d canvases
clear overlay canvas if using glPostIncludeOverlay
  • Loading branch information
KilledByAPixel committed Nov 15, 2024
1 parent 3418d7c commit 2f30cba
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions plugins/postProcess.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,6 @@ function initPostProcess(shaderCode, includeOverlay=false)
glPostTexture = glCreateTexture(undefined);
glPostIncludeOverlay = includeOverlay;

// hide the original 2d canvas
mainCanvas.style.visibility = 'hidden';
if (glPostIncludeOverlay)
overlayCanvas.style.visibility = 'hidden';

// Render the post processing shader, called automatically by the engine
engineAddPlugin(undefined, postProcessRender);
function postProcessRender()
Expand All @@ -72,8 +67,12 @@ function initPostProcess(shaderCode, includeOverlay=false)
glContext.viewport(0, 0, glCanvas.width = mainCanvas.width, glCanvas.height = mainCanvas.height);
}

// copy overlay canvas so it will be included in post processing
glPostIncludeOverlay && mainContext.drawImage(overlayCanvas, 0, 0);
if (glPostIncludeOverlay)
{
// copy overlay canvas so it will be included in post processing
mainContext.drawImage(overlayCanvas, 0, 0);
overlayCanvas.width |= 0;
}

// setup shader program to draw one triangle
glContext.useProgram(glPostShader);
Expand Down

0 comments on commit 2f30cba

Please sign in to comment.