这是来自 openGL 超级圣经(第 5 版,第 208 页)的引述:
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)
。知道我可能会错过什么吗?