GLuint TextureController::_CreateBlankGLTexture(int32 width, int32 height) {
	GLuint tex_id;
	glGenTextures(1, &tex_id);

	if (VideoManager->CheckGLError()) {
		IF_PRINT_WARNING(VIDEO_DEBUG) << "an OpenGL error was detected: " << VideoManager->CreateGLErrorString() << endl;
		_DeleteTexture(tex_id);
		return INVALID_TEXTURE_ID;
	}

	_BindTexture(tex_id); // NOTE: this call makes another call to VideoManager->CheckGLError()

	// If the binding was successful, initialize the texture with glTexImage2D()
	if (VideoManager->GetGLError() == GL_NO_ERROR) {
		glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
	}

	if (VideoManager->CheckGLError()) {
		PRINT_ERROR << "failed to create new texture. OpenGL reported the following error: " << VideoManager->CreateGLErrorString() << endl;
		_DeleteTexture(tex_id);
		return INVALID_TEXTURE_ID;
	}

	// Set linear texture interpolation only if we are at a non-natural resolution
	GLenum filtering_type = VideoManager->_ShouldSmooth() ? GL_LINEAR : GL_NEAREST;

	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filtering_type);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filtering_type);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);

	return tex_id;
}
GLuint TextureController::_CreateBlankGLTexture(int32_t width, int32_t height)
{
    GLuint tex_id;
    glGenTextures(1, &tex_id);

    if(VideoManager->CheckGLError()) {
        IF_PRINT_WARNING(VIDEO_DEBUG) << "an OpenGL error was detected: " << VideoManager->CreateGLErrorString() << std::endl;
        _DeleteTexture(tex_id);
        return INVALID_TEXTURE_ID;
    }

    _BindTexture(tex_id);

    // If the binding was successful, initialize the texture with glTexImage2D()
    if(VideoManager->GetGLError() == GL_NO_ERROR) {
        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
    }

    if(VideoManager->CheckGLError()) {
        PRINT_ERROR << "failed to create new texture. OpenGL reported the following error: " << VideoManager->CreateGLErrorString() << std::endl;
        _DeleteTexture(tex_id);
        return INVALID_TEXTURE_ID;
    }

    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);

    return tex_id;
}