这里是openGL的超级宝典报价(第5版,第208号):如何防止openGL中的闪烁(抗锯齿伪像)?
The first is an effect called scintillation (aliasing artifacts) that appears
on the surface of objects rendered very small on-screen compared to the
relative size of the texture applied. Scintillation can be seen as a sort of
sparkling that occurs as the sampling area on a texture map moves
disproportionately to its size on the screen. The negative effects of
scintillation are most noticeable when the camera or the objects are in motion.
我目前所面临的相同问题,(我加载图像4912 X 3264个像素),并做一些仿射变换如旋转和平移。它显示出模糊性,特别是当纹理加载有白色像素(这可能不是一般的观察,但我正在观察这一点)。下面是代码:
glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D, texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, image->width,image->height, 0, GL_BGR, GL_UNSIGNED_BYTE, image->imageData);
//gluBuild2DMipmaps(GL_TEXTURE_2D,GL_RGB,image->width,image->height, GL_BGR,GL_UNSIGNED_BYTE,image->imageData);
的动画是光滑的一切都很除了那些破坏者完美。 有人可以帮助我改善这种情况,因为我正在开发一个应用程序,它会对这些东西有很大的担忧吗?
另外如果在使用glTexImage2D
后,如果我使用glGenerateMipmap(GL_TEXTURE_2D)
,它会给出segmentation fault (core dump)
。任何想法我可能会失踪?
你是在正确的轨道上。 Mipmaps可以改善纹理伪影的情况。它只是定义了两种尺寸纹理的功率。 –
@DanielFlassig:胡话。 Mipmaps适用于任意大小的纹理。不要传递错误信息。 –
@NicolBolas:对不起,那我的信息已经过时了。它曾经是这样的(http://www.khronos.org/opengles/sdk/docs/man/xhtml/glGenerateMipmap.xml)我会检查新的规范。 –