本文整理汇总了C++中Texture2D::Generate方法的典型用法代码示例。如果您正苦于以下问题:C++ Texture2D::Generate方法的具体用法?C++ Texture2D::Generate怎么用?C++ Texture2D::Generate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Texture2D
的用法示例。
在下文中一共展示了Texture2D::Generate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadTextureFromFile
Texture2D ResourceManager::loadTextureFromFile(const GLchar *file, GLboolean alpha, GLboolean repeat)
{
// Create Texture object
Texture2D texture;
if (alpha)
{
texture.Internal_Format = GL_RGBA;
texture.Image_Format = GL_RGBA;
}
if (repeat)
{
texture.Wrap_S = GL_REPEAT;
texture.Wrap_T = GL_REPEAT;
}
// Load image
int width, height;
unsigned char* image = SOIL_load_image(file, &width, &height, 0, texture.Image_Format == GL_RGBA ? SOIL_LOAD_RGBA : SOIL_LOAD_RGB);
if (!image){
std::cout << "ERROR::TEXTURE: " << SOIL_last_result() << std::endl;
return texture;
}
// Now generate texture
texture.Generate(width, height, image);
// And finally free image data
SOIL_free_image_data(image);
return texture;
}
示例2: loadTextureFromFile
Texture2D ResourceManager::loadTextureFromFile(const GLchar * file, GLboolean alpha)
{
Texture2D texture;
if (alpha)
{
texture.InternalFormat = GL_RGBA;
texture.ImageFormat = GL_RGBA;
}
// Load image and generate texture, then clear resources
int width, height;
unsigned char* image = SOIL_load_image(file, &width, &height, 0, texture.ImageFormat == GL_RGBA ? SOIL_LOAD_RGBA : SOIL_LOAD_RGB);
texture.Generate(width, height, image);
SOIL_free_image_data(image);
return texture;
}
示例3: loadTextureFromFile
Texture2D ResourceManager::loadTextureFromFile(const GLchar *file, GLboolean alpha)
{
// Create Texture object
Texture2D texture;
if (alpha)
{
texture.Internal_Format = GL_RGBA;
texture.Image_Format = GL_RGBA;
}
// Load image
int width, height;
unsigned char* image = SOIL_load_image(file, &width, &height, 0, texture.Image_Format == GL_RGBA ? SOIL_LOAD_RGBA : SOIL_LOAD_RGB);
// Now generate texture
texture.Generate(width, height, image);
// And finally free image data
SOIL_free_image_data(image);
return texture;
}