<commit_before>#include "Texture.h"

Texture::Texture( const std::string& file )
: BaseResource(file),
mWidth(0),
mHeight(0),
mName(0),
mFilter(GL_NEAREST)
{
	
}

Texture::~Texture()
{
	
}

void Texture::load()
{
	sf::Image image;
	if(!image.loadFromFile(mFilename)) return;
	
	glGenTextures(1, &mName);
	mWidth = image.getSize().x;
	mHeight = image.getSize().y;
	glBindTexture(GL_TEXTURE_2D, mName);
	gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, image.getSize().x, image.getSize().y, GL_RGBA, GL_UNSIGNED_BYTE, image.getPixelsPtr());
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, mFilter);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, mFilter);
	
	glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
	glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );

	glBindTexture(GL_TEXTURE_2D, 0);
}<commit_msg>Texture resource now frees on delete<commit_after>#include "Texture.h"

Texture::Texture( const std::string& file )
: BaseResource(file),
mWidth(0),
mHeight(0),
mName(0),
mFilter(GL_NEAREST)
{
	
}

Texture::~Texture()
{
	if( mName != 0 )
	{
		glDeleteTextures(1, mName);
	}
}

void Texture::load()
{
	sf::Image image;
	if(!image.loadFromFile(mFilename)) return;
	
	glGenTextures(1, &mName);
	mWidth = image.getSize().x;
	mHeight = image.getSize().y;
	glBindTexture(GL_TEXTURE_2D, mName);
	gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, image.getSize().x, image.getSize().y, GL_RGBA, GL_UNSIGNED_BYTE, image.getPixelsPtr());
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, mFilter);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, mFilter);
	
	glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
	glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );

	glBindTexture(GL_TEXTURE_2D, 0);
}
{'fraction_non_alphanumeric': 0.1387800783435926, 'fraction_numerical': 0.01566871852266368, 'mean_word_length': 7.596153846153846, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7561542', 'n_tokens_mistral': 778, 'n_tokens_neox': 739, 'n_words': 108}