@@ -164,6 +164,7 @@ function rendererWebGPU(p5, fn) {
164164
165165 _updateSize ( ) {
166166 if ( this . depthTexture && this . depthTexture . destroy ) {
167+ this . flushDraw ( ) ;
167168 this . depthTexture . destroy ( ) ;
168169 this . depthTextureView = null ;
169170 }
@@ -886,8 +887,17 @@ function rendererWebGPU(p5, fn) {
886887 this . _pendingCommandEncoders . push ( commandEncoder . finish ( ) ) ;
887888 this . _hasPendingDraws = true ;
888889
890+ // Save current transformation state
891+ const savedModelMatrix = this . states . uModelMatrix . copy ( ) ;
892+
893+ // Copy current camera state to framebuffer's camera
894+ this . mainFramebuffer . defaultCamera . set ( this . states . curCamera ) ;
895+
889896 // Activate mainFramebuffer for subsequent draws
890897 this . mainFramebuffer . begin ( ) ;
898+
899+ // Restore transformation state
900+ this . states . uModelMatrix . set ( savedModelMatrix ) ;
891901 }
892902
893903 //////////////////////////////////////////////
@@ -1048,7 +1058,7 @@ function rendererWebGPU(p5, fn) {
10481058 // Only submit if we actually had any draws
10491059 if ( this . _hasPendingDraws ) {
10501060 // Create a copy of pending command encoders
1051- const commandsToSubmit = this . _pendingCommandEncoders . slice ( ) ;
1061+ const commandsToSubmit = this . _pendingCommandEncoders ;
10521062 this . _pendingCommandEncoders = [ ] ;
10531063 this . _hasPendingDraws = false ;
10541064
@@ -1083,6 +1093,10 @@ function rendererWebGPU(p5, fn) {
10831093 this . flushDraw ( ) ;
10841094 }
10851095
1096+ finishSetup ( ) {
1097+ this . flushDraw ( ) ;
1098+ }
1099+
10861100 async finishDraw ( ) {
10871101 this . flushDraw ( ) ;
10881102
0 commit comments