|  | @@ -1950,14 +1950,15 @@ void tnsConfigure2DTexture(tnsTexture *t){
 | 
	
		
			
				|  |  |          int format=isDepth?GL_DEPTH_COMPONENT:GL_RGBA;
 | 
	
		
			
				|  |  |          if(t->Multisample) glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, t->Multisample, t->GLTexBitsType, t->Width, t->Height, GL_TRUE);
 | 
	
		
			
				|  |  |          else{ glTexImage2D(GL_TEXTURE_2D, 0, t->GLTexBitsType, t->Width, t->Height, 0, format, GL_UNSIGNED_BYTE, 0);
 | 
	
		
			
				|  |  | -            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
 | 
	
		
			
				|  |  | -            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
 | 
	
		
			
				|  |  | +            int a=a=glGetError();
 | 
	
		
			
				|  |  | +            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
 | 
	
		
			
				|  |  | +            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
 | 
	
		
			
				|  |  |              glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
 | 
	
		
			
				|  |  |              glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
 | 
	
		
			
				|  |  |              //glTexEnvi(GL_TEXTURE_2D, GL_TEXTURE_ENV_MODE, GL_REPLACE);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | -    tnsUnbindTexture(t);
 | 
	
		
			
				|  |  | +    tnsUnbindTexture();
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  void tnsConfigure3DTexture(tnsTexture *t){
 | 
	
		
			
				|  |  |      tnsBindTexture(t);
 | 
	
	
		
			
				|  | @@ -1968,7 +1969,7 @@ void tnsConfigure3DTexture(tnsTexture *t){
 | 
	
		
			
				|  |  |          glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
 | 
	
		
			
				|  |  |          glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
 | 
	
		
			
				|  |  |          //glTexEnvi(GL_TEXTURE_2D, GL_TEXTURE_ENV_MODE, GL_REPLACE);
 | 
	
		
			
				|  |  | -    tnsUnbindTexture(t);
 | 
	
		
			
				|  |  | +    tnsUnbindTexture();
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  void tnsReconfigureTextureParameters(int Multisample){
 | 
	
	
		
			
				|  | @@ -1983,14 +1984,14 @@ void tnsReconfigureTextureParameters(int Multisample){
 | 
	
		
			
				|  |  |              if(recreate){
 | 
	
		
			
				|  |  |                  glDeleteTextures(1, &t->GLTexHandle);
 | 
	
		
			
				|  |  |                  glGenTextures(1, &t->GLTexHandle);
 | 
	
		
			
				|  |  | -                T->TexColor=0;
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +            T->TexColor=0;
 | 
	
		
			
				|  |  |              tnsConfigure2DTexture(t);
 | 
	
		
			
				|  |  |              tnsAttach2DOffscreenBuffer(o, GL_COLOR_ATTACHMENT0, t);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          t=o->pDepth;
 | 
	
		
			
				|  |  |          if(t){
 | 
	
		
			
				|  |  | -            t->Multisample = Multisample;
 | 
	
		
			
				|  |  | +            t->Multisample = Multisample; T->TexColor=0;
 | 
	
		
			
				|  |  |              tnsConfigure2DTexture(t);
 | 
	
		
			
				|  |  |              tnsAttach2DOffscreenBuffer(o, GL_DEPTH_ATTACHMENT, t);
 | 
	
		
			
				|  |  |          }
 | 
	
	
		
			
				|  | @@ -2045,7 +2046,7 @@ void tnsActiveTexture(GLenum tex){
 | 
	
		
			
				|  |  |      T->GlTextureSets = tex;
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  void tnsBindTexture(tnsTexture *t){
 | 
	
		
			
				|  |  | -    if (!t || T->TexColor==t) return;
 | 
	
		
			
				|  |  | +    if ((!t) || T->TexColor==t) return;
 | 
	
		
			
				|  |  |      if(t->GLTexType == GL_TEXTURE_2D){ tnsActiveTexture(GL_TEXTURE0); glBindTexture(t->GLTexType, t->GLTexHandle); T->TexColor=t;}
 | 
	
		
			
				|  |  |      elif(t->GLTexType == GL_TEXTURE_2D_MULTISAMPLE){ tnsActiveTexture(GL_TEXTURE1); glBindTexture(t->GLTexType, t->GLTexHandle); T->TexColor=t;}
 | 
	
		
			
				|  |  |      elif(t->GLTexType == GL_RENDERBUFFER){ glBindRenderbufferEXT(GL_RENDERBUFFER, t->GLTexHandle); T->TexRenderbuffer = t;}
 | 
	
	
		
			
				|  | @@ -2057,7 +2058,7 @@ void tnsUnbindTexture(){
 | 
	
		
			
				|  |  |          if(T->TexColor->GLTexType == GL_TEXTURE_2D){tnsActiveTexture(GL_TEXTURE0);}
 | 
	
		
			
				|  |  |          else if(T->TexColor->GLTexType == GL_TEXTURE_2D_MULTISAMPLE){tnsActiveTexture(GL_TEXTURE1);}
 | 
	
		
			
				|  |  |          else if(T->TexColor->GLTexType == GL_TEXTURE_3D){tnsActiveTexture(GL_TEXTURE0);}
 | 
	
		
			
				|  |  | -        glBindTexture(T->TexColor->GLTexType, -1); T->TexColor=0;
 | 
	
		
			
				|  |  | +        glBindTexture(T->TexColor->GLTexType, 0); T->TexColor=0;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  void tnsUniformUseTexture(tnsShader* s, int mode, int sample){
 | 
	
	
		
			
				|  | @@ -2274,6 +2275,7 @@ void tnsUseImage(tnsImage* im){
 | 
	
		
			
				|  |  |          for(int i=0;i<H;i++){ png_read_row(png_ptr, &buf[((H-i-1)*W)*4], NULL); }
 | 
	
		
			
				|  |  |          im->Texture=tnsCreate2DTexture(GL_RGBA8,W,H,0);
 | 
	
		
			
				|  |  |          tnsBindTexture(im->Texture); glTexSubImage2D(GL_TEXTURE_2D,0,0,0,W,H,GL_RGBA,GL_UNSIGNED_BYTE,buf);
 | 
	
		
			
				|  |  | +        tnsUnbindTexture();
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  cleanup_png_read:
 | 
	
		
			
				|  |  |      if(png_ptr && info_ptr) png_destroy_read_struct(&png_ptr,&info_ptr,0);
 | 
	
	
		
			
				|  | @@ -3192,6 +3194,7 @@ int CMP_NAME_IsThisFont(tnsFont *enumed, char *name){
 | 
	
		
			
				|  |  |  };
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  int tnsStringGetDimension(char* content, uint32_t* contentU, int Count, int WLimit, int* Rows, int UseMono){
 | 
	
		
			
				|  |  | +    if((!MAIN.CurrentWindow)||(!MAIN.CurrentWindow->win)) return 0;
 | 
	
		
			
				|  |  |      real sx = 0; int sy = FM->UsingFont->height; real MA=FM->UsingFont->MonoAdvance;
 | 
	
		
			
				|  |  |      int i, rows=1, advance=1;
 | 
	
		
			
				|  |  |      int C = 0;
 |