Модификация класса текстуры
This commit is contained in:
		
							parent
							
								
									ec12f80627
								
							
						
					
					
						commit
						a1a562ff4b
					
				| @ -35,6 +35,7 @@ class Texture : public BaseTexture | ||||
|     public: | ||||
|         Texture(GLuint type = TEX_AVAILABLE_COUNT, const std::string& filename = ""); // Загрузка текстуры с диска или использование "пустой"
 | ||||
|         Texture(GLuint width, GLuint height, GLuint attachment, GLuint texType = TEX_DIFFUSE, GLint internalformat = GL_RGBA, GLint format = GL_RGBA, GLenum dataType = GL_FLOAT); // Конструктор текстуры заданного размера для использования в буфере
 | ||||
|         Texture(GLuint width, GLuint height, void* data, GLuint texType = TEX_DIFFUSE, GLint internalformat = GL_RGBA, GLint format = GL_RGBA, GLenum dataType = GL_FLOAT); // Конструктор текстуры заданного размера без привязки к буферу с загрузкой пикселей по указателю
 | ||||
|         Texture(const Texture& other); // Конструктор копирования
 | ||||
| 
 | ||||
|         Texture& operator=(const Texture& other); // Оператор присваивания
 | ||||
|  | ||||
| @ -78,6 +78,21 @@ Texture::Texture(GLuint width, GLuint height, GLuint attachment, GLuint texType, | ||||
|     handler_count[handler] = 1; | ||||
| } | ||||
| 
 | ||||
| // Конструктор текстуры заданного размера без привязки к буферу с загрузкой пикселей по указателю
 | ||||
| Texture::Texture(GLuint width, GLuint height, void* data, GLuint texType, GLint internalformat, GLint format, GLenum dataType) | ||||
| { | ||||
|     type = texType; | ||||
|     // Генерация текстуры заданного размера
 | ||||
|     glGenTextures(1, &handler); | ||||
|     glBindTexture(GL_TEXTURE_2D, handler); | ||||
|     glTexImage2D(GL_TEXTURE_2D, 0, internalformat, width, height, 0, format, dataType, data); | ||||
|     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); | ||||
|     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); | ||||
| 
 | ||||
|     // Создаем счетчик использований дескриптора
 | ||||
|     handler_count[handler] = 1; | ||||
| } | ||||
| 
 | ||||
| // Конструктор копирования
 | ||||
| Texture::Texture(const Texture& other) | ||||
| { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user