質問

I'm learning OpenGL and I used SOIL lib to map a texture(PNG file) to a quad (follow NeHe tutorials).NeHe used a image size 256x256. Can I use a smaller picture ?(any size or power of 2 size) ? my load texture function:

int LoadGLTextures()                                    
{


    texture[0] = SOIL_load_OGL_texture
        (
        "NeHe.png",
       SOIL_LOAD_AUTO,
        SOIL_CREATE_NEW_ID,
SOIL_FLAG_MIPMAPS | SOIL_FLAG_INVERT_Y | SOIL_FLAG_NTSC_SAFE_RGB | SOIL_FLAG_COMPRESS_TO_DXT |SOIL_FLAG_POWER_OF_TWO 
        );

    if(texture[0] == 0)
        return false;

    //glGenTextures(1, &texture[0]);
    glBindTexture(GL_TEXTURE_2D, texture[0]);
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);


    return true;                                        // Return Success
}
役に立ちましたか?

解決

I think you have Re size your picture with photoshop or same software and be aware that your picture size should be power of 2 and between 64 and 256.and there is no need to code for that, but the size of openGL screen that you want to use for loading the picture can be determined with coding;)

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top