当前位置: 首页>>代码示例>>C++>>正文


C++ Texture2D::Generate方法代码示例

本文整理汇总了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;
}
开发者ID:Chadys,项目名称:Demo_OpenGL,代码行数:27,代码来源:ResourceManager.cpp

示例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;
}
开发者ID:LonamiWebs,项目名称:CubicSystem,代码行数:16,代码来源:resource_manager.cpp

示例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;    
}
开发者ID:phowgego,项目名称:SuperBubble,代码行数:19,代码来源:resource_manager.cpp


注:本文中的Texture2D::Generate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。