简体   繁体   English

GL_FLOAT 和 GL_LUMINANCE 的线性插值?

[英]Linear interpolation with GL_FLOAT and GL_LUMINANCE?

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.我在iPad 3.显影使用OpenGL ES 2.0应用程式我试图从切换GL_UNSIGNED_BYTE调用时glTexImage2D()GL_FLOAT为“ type ”,用GL_LUMINANCE为“ internalFormat ”和“ format ”参数。 (formerly GL_RGBA ) (以前的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 ?我需要切换到GL_RGBA而不是GL_LUMINANCE吗? Does using GL_LUMINANCE automatically disable interpolation?使用GL_LUMINANCE是否会自动禁用插值?

In my shader I start with:在我的着色器中,我开始于:

highp vec4 tex = texture2D(Texture, TexCoordOut);

just like I did before when using GL_UNSIGNED_BYTE .就像我之前使用GL_UNSIGNED_BYTE时所做的那样。 TexCoordOut is the interpolated output from the vertex shader. TexCoordOut是顶点着色器的插值输出。 Why isn't it interpolating anymore, after switching to luminance and float?为什么在切换到亮度和浮动后不再进行插值?

ps I AM calling: ps我打电话:

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.就在glTexImage2D()之前,但我的印象是这些调用在 OpenGL ES 2.0 下无论如何都不起作用。

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.我只记得:当使用 GL_FLOAT 时,GL_LINEAR 在 OpenGL ES 2.0 上不可用,除非支持 GL_OES_texture_float_linear 扩展,它在 iPad 3 及更早版本上不可用。

Since the GL_OES_texture_half_float_linear extension IS supported, I'll have to look into using that.由于支持 GL_OES_texture_half_float_linear 扩展名,我将不得不考虑使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM