Question

I'm developing an app using OpenGL ES 2.0 on an iPad 3. I'm attempting to switch from GL_UNSIGNED_BYTE when calling glTexImage2D() to GL_FLOAT for "type", with GL_LUMINANCE as the "internalFormat" and "format" parameters. (formerly GL_RGBA)

The problem: linear interpolation is now gone. When you scale up, it's very pixelated instead of smooth, as it would be with linear interpolation. Do I need to switch to GL_RGBA instead of GL_LUMINANCE? Does using GL_LUMINANCE automatically disable interpolation?

In my shader I start with:

highp vec4 tex = texture2D(Texture, TexCoordOut);

just like I did before when using GL_UNSIGNED_BYTE. TexCoordOut is the interpolated output from the vertex shader. Why isn't it interpolating anymore, after switching to luminance and float?

p.s. I AM calling:

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

just before glTexImage2D(), but I'm under the impression these calls do nothing anyway under OpenGL ES 2.0.

Was it helpful?

Solution

I just remembered: GL_LINEAR is not available on OpenGL ES 2.0 when GL_FLOAT is used, unless the GL_OES_texture_float_linear extension is supported, which it is not on the iPad 3 and earlier.

Since the GL_OES_texture_half_float_linear extension IS supported, I'll have to look into using that.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top