| 
					
				 | 
			
			
				@@ -1,6 +1,6 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #include "wrapper/Texture.h" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-Texture::Texture(const TextureFormat& format) : format(format), texture(0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+Texture::Texture(const TextureFormat& format, int maxMipMaps) : format(format), texture(0), maxMipMaps(maxMipMaps) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     glGenTextures(1, &texture); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     setNearestFilter(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     setRepeatWrap(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -17,18 +17,26 @@ void Texture::setFormat(const TextureFormat& tf) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     format = tf; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-void Texture::setFilter(GLint param) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+void Texture::setFilter(GLint minParam, GLint maxParam) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     bind(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, param); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, param); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, minParam); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, maxParam); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 void Texture::setNearestFilter() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    setFilter(GL_NEAREST); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if(maxMipMaps > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        setFilter(GL_NEAREST_MIPMAP_LINEAR, GL_NEAREST); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        setFilter(GL_NEAREST, GL_NEAREST); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 void Texture::setLinearFilter() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    setFilter(GL_LINEAR); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if(maxMipMaps > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        setFilter(GL_LINEAR, GL_LINEAR); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        setFilter(GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 void Texture::setWrap(GLint param) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -46,8 +54,13 @@ void Texture::setClampWrap() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 void Texture::setData(int width, int height, const void* data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    glBindTexture(GL_TEXTURE_2D, texture); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    bind(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     glTexImage2D(GL_TEXTURE_2D, 0, format.internalformat, width, height, 0, format.format, format.type, data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if(maxMipMaps > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, maxMipMaps); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        glGenerateMipmap(GL_TEXTURE_2D); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 void Texture::bind() const { 
			 |