是否可以提交一个用于绘制基本线框球体的代码而无需对其进行纹理化。我找到了很多例子,但他们使用了3种缓冲区,如法线,纹理和顶点。有没有使用GL_TRIANGLE_FAN或GL_TRIANGLE_STRIP并仅使用顶点和片段着色器绘制球体的简单综合方法。
谢谢!
答案 0 :(得分:0)
void DrawSphere(GLdouble radius, int longitudeSubdiv, int latitudeSubdiv)
{
// issue corresponding GL command
//glPolygonMode(GL_BACK,GL_FILL);
//gluSphere(m_quadrObj,radius,longitudeSubdiv,latitudeSubdiv);
float color1[3] = {1.0,0.0,0.0};
float shininess = 64.0f;
float specularColor[] = {1.0, 1.0f, 1.0f, 1.0f};
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, shininess); // range 0 ~ 128
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specularColor);
glPushMatrix();
glTranslatef(1,1,1);// *
glColor3fv(color1);
gluSphere(m_quadrObj,radius,longitudeSubdiv,latitudeSubdiv);
glPopMatrix();
//glColor3fv(color2);
}