Using XCode 4.4.1 I have the following OpenGL code:
//set the tex params
glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR_MIPMAP_LINEAR);
I check the OpenGL error using this snippet:
GLenum err = glGetError();//THIS IS LIKE THIS BECAUSE OF AN EARLIER ERROR
if (err != GL_NO_ERROR)
{
NSLog(@"glError: 0x%04X", i, err);
}
The OpenGL code produces an error (0x500) - I'm targetting iOS 5.0 with OpenGL ES2.0.
Why is this an invalid enum??
The magnifaction filter GL_TEXTURE_MAG_FILTER
doesn't support mip-mapping, as this just has no meaning for texture magnification. It only supports GL_NEAREST
and GL_LINEAR
. So just change this line to
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With