本文介绍了OpenGL Alpha混合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试创建一个小型的太阳系,并在opengl中对其进行渲染.我得到了几个围绕origo旋转的球体,上面带有行星纹理.
其中一颗行星通过在相同位置创建具有Alpha混合纹理的稍大的球体而创建了大气.
一切正常,除了从远处观看时,它看起来像黑色的涟漪在大气中.只有从远处观看.当关闭时,它可以正常工作.
I''m trying to create a small solar system and render it uding opengl. I got several spheres rotating around origo with planetary textures on them.
One of the planets got an atmosphere created by creating a slightly larger sphere at the same position with a texture with alpha blending.
Everything works except when the watched from a distanace it looks like black riples in the atmosphere. It''s only when watched froma distance. When up close it''s working perfectly.
void drawAtmo()
{
glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE);
glPushMatrix();
glEnable(GL_CULL_FACE);
glEnable(GL_DEPTH_TEST);
glEnable(GL_TEXTURE_2D);
glColor4f(1, 1, 1 ,0.5);
glBindTexture(GL_TEXTURE_2D, shared.earthTexture1);
gluSphere(shared.quadric, 3.2, 32, 32);
glPopMatrix();
glDisable(GL_BLEND);
}
推荐答案
这篇关于OpenGL Alpha混合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!