For best practice, which glTexParameters should I set when creating a texture?

I am already using a mipmap and anisotropic filtering, but I am not sure if this is enough for each texture or if I should also define some parameters for magnifying and minimizing (i.e. GL_TEXTURE_MIN_FILTER, GL_TEXTURE_MAG_FILTER, etc).

I am creating a texture for a simple game engine I am writing.


1 Answer 1


There's no best practice for this; instead you set the parameters according to the needs of your program.

There are certain technical requirements which will depend on the capabilitis of your OpenGL implementation, so I would suggest reviewing the glTexParameter documentation where the requirements for each parameter are discussed.

One I will highlight is that if you are using a GL_TEXTURE_MIN_FILTER with one of the MIPMAP options in it, you must have also specified a full mipmap chain when specifying the texture.

A common mistake is that the initial value of GL_TEXTURE_MIN_FILTER is GL_NEAREST_MIPMAP_LINEAR, so if you (1) don't specify a full mipmap chain, but also (2) don't specify a GL_TEXTURE_MIN_FILTER without mipmaps, you'll have an invalid combination of state.

Personally I would recommend using glTexStorage and sampler objects instead of glTexImage and texture parameters. glTexStorage will help you avoid accidentally creating incomplete textures, and sampler objects are more flexible in that they decouple these states from the texture object.

  • \$\begingroup\$ But I need to stay with glTexImage, because my system is not supporting openGL 4.2. I will keep this in mind when I get new Hardware :D \$\endgroup\$
    – string111
    Oct 13, 2016 at 9:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .