C++ Opengl半球内表面

C++ Opengl半球内表面,c++,opengl,geometry,C++,Opengl,Geometry,我想尝试创建一个半球 这是我的密码 void drawHalfSphere(int scaley, int scalex, GLfloat r) { int i, j; GLfloat v[scalex*scaley][3]; for (i=0; i<scalex; ++i) { for (j=0; j<scaley; ++j) { v[i*scaley+j][0]=r*cos(j*2*M_PI/scaley)*cos(i*M_PI/(2*scalex)); v[

我想尝试创建一个半球

这是我的密码

void drawHalfSphere(int scaley, int scalex, GLfloat r) {
int i, j;
GLfloat v[scalex*scaley][3];

for (i=0; i<scalex; ++i) {
 for (j=0; j<scaley; ++j) {
    v[i*scaley+j][0]=r*cos(j*2*M_PI/scaley)*cos(i*M_PI/(2*scalex));
    v[i*scaley+j][1]=r*sin(i*M_PI/(2*scalex));
    v[i*scaley+j][2]=r*sin(j*2*M_PI/scaley)*cos(i*M_PI/(2*scalex));
 }
}

glBegin(GL_QUADS);
for (i=0; i<scalex-1; ++i) {
  for (j=0; j<scaley; ++j) {
    glVertex3fv(v[i*scaley+j]);
    glVertex3fv(v[i*scaley+(j+1)%scaley]);
    glVertex3fv(v[(i+1)*scaley+(j+1)%scaley]);
    glVertex3fv(v[(i+1)*scaley+j]);
  }
}
glEnd();
}


void RenderScene() 
{
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  glLoadIdentity (); 

  glRotatef(fRotation,1,0,0);
  glColor3f(1,0,0);
  drawHalfSphere(25.0,25.0,0.5);
  glutSwapBuffers();
}
void drawHalfSphere(int-scaley、int-scalex、glr){
int i,j;
GLfloat v[scalex*scaley][3];

对于(i=0;i在初始化期间,您是否尝试过:

glCullFace(GL_FRONT_AND_BACK);
或者你的远飞机离得太近了:

 void gluPerspective(...,GLdouble zFar);

然后他可能应该叫自己Hemonking:)是的,我的意思是抱歉;)我的英语不是最好的你是对的,这是我的观点,zFar值太小了:)太多了