hi there,
my code to create textures looks like this:
/* generate new texture */
GLuint texture = 0;
glCreateTextures(GL_TEXTURE_2D, 1, &texture);
glTextureStorage2D(texture, 1, GL_RGBA8, w, h);
glTextureSubImage2D(texture, 0, 0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, texture_data);
//glGenerateTextureMipmap(texture);
glTextureParameteri(texture, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTextureParameteri(texture, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTextureParameteri(texture, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
glTextureParameteri(texture, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
fragment shader:
vec3 Ks = material_Ks * texture(map_Ks, fs_in.texcoord).rgb;
my textures are all “static”, so they dont change in size and content. thats why i thought, that using glTextureStorage2D(…) is appropriate. i dont have experience in using LODs, never tested that.
am i right, that increasing the LOD parameter in glTextureStorage2D(…) to (lets say) 10 (for 1024x1024 textures) and uncomment the glGenerateTextureMipmap(texture); will do the job?
i assume i have to compress all my .jpg and .png files to .dds (DXT1 compression) beforehand, because i have to deliver “compressed texture data” to opengl. what tool can i use for that?
thanks in advance for any suggestions !!