@@ -55,9 +55,12 @@ var webgl_quadFeature = function (arg) {
5555 newbuf = false ;
5656
5757 if ( m_quads . imgQuads . length ) {
58+ if ( renderState . m_contextChanged ) {
59+ m_glBuffers . imgQuadsPosition = null ;
60+ }
5861 if ( ! m_imgposbuf || m_imgposbuf . length < m_quads . imgQuads . length * 12 ||
5962 ! m_glBuffers . imgQuadsPosition ) {
60- if ( m_glBuffers . imgQuadsPosition ) {
63+ if ( m_glBuffers . imgQuadsPosition && ! renderState . m_contextChanged ) {
6164 context . deleteBuffer ( m_glBuffers . imgQuadsPosition ) ;
6265 }
6366 m_glBuffers . imgQuadsPosition = context . createBuffer ( ) ;
@@ -93,9 +96,12 @@ var webgl_quadFeature = function (arg) {
9396 newbuf = false ;
9497
9598 if ( m_quads . clrQuads . length ) {
99+ if ( renderState . m_contextChanged ) {
100+ m_glBuffers . clrQuadsPosition = null ;
101+ }
96102 if ( ! m_clrposbuf || m_clrposbuf . length < m_quads . clrQuads . length * 12 ||
97103 ! m_glBuffers . clrQuadsPosition ) {
98- if ( m_glBuffers . clrQuadsPosition ) {
104+ if ( m_glBuffers . clrQuadsPosition && ! renderState . m_contextChanged ) {
99105 context . deleteBuffer ( m_glBuffers . clrQuadsPosition ) ;
100106 }
101107 m_glBuffers . clrQuadsPosition = context . createBuffer ( ) ;
@@ -393,7 +399,10 @@ var webgl_quadFeature = function (arg) {
393399 nearestPixel = curZoom >= nearestPixel ;
394400 }
395401 m_quads . imgQuads . forEach ( ( quad ) => {
396- if ( ( quad . image || quad . imageTexture ) && quad . texture && quad . texture . nearestPixel ( ) !== nearestPixel && quad . texture . textureHandle ( ) ) {
402+ if ( ( quad . image || quad . imageTexture ) && quad . texture &&
403+ quad . texture . nearestPixel ( ) !== nearestPixel &&
404+ quad . texture . textureHandle ( ) &&
405+ quad . texture . hasContext ( renderState . m_context ) ) {
397406 /* This could just be
398407 * quad.texture.setNearestPixel(nearestPixel);
399408 * but that needlessly redecodes the image. Instead, just change the
0 commit comments