# why my triangles can be seen in the window?

i am a beginner. This is my code:

glClearColor(0.3f,0.6f,0.7f,1.0f);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

glMatrixMode(GL_MODELVIEW);

glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
glLineWidth(1.0f);
glColor3f(0.0f,0.0f,0.0f);

glPushMatrix();
for (int i=0;i<(Numplanes-1);i++)
glBegin(GL_TRIANGLE_STRIP);
for (int j=0;j<(NumPointsOnPlane);j++)
{
glVertex3d(a[i][j],b[i][j],c[i][j]);
glVertex3d(a[i+1][j],b[i+1][j],c[i+1][j]); } glVertex3d(a[i],b[i],c[i]); glVertex3d(a[i+1][j],b[i+1][j],c[i+1][j]);
glEnd();
}

and a={3.7558881e+02 3.7241258e+02
-3.6916080e+02 -3.7014718e+02 …}
b=
{2.0283400e+03 2.0298425e+03
2.0315526e+03 2.0330736e+03 …}

c={-1.6000000e+02 -1.6000000e+02
-1.6000000e+02 -1.6000000e+02

}

I think there are something wrong,but i don’t know where it is .
could you help me ?

thank you very much.

You have to setup your window in your Resize() function so that a whole triangle can be seen. I usually use glFrustum so I’d have something like this:

// glFrustum(left, right, top, bottom, near, far);
glFrustum(-400.0f, 400.0f, 400.0f, 400.0f, 10.0f, 1000.0f);

Hope that helps.

Maybe try this code adjustment. Everytime you change the state it is the same as rendering thousands of triangles. maybe try this:
glBegin(GL_TRIANGLE_STRIP);
for (int i=0;i<(Numplanes-1);i++)
for (int j=0;j<(NumPointsOnPlane);j++)
{
glVertex3d(a[i][j],b[i][j],c[i][j]);
glVertex3d(a[i+1][j],b[i+1][j],c[i+1][j]); } glVertex3d(a[i],b[i],c[i]); glVertex3d(a[i+1][j],b[i+1][j],c[i+1][j]);
}
glEnd();

Thank you all.
I’ve solved problem now.
I can’t see my triangles because I set wrong Frustum, and my triangles were out of viewport. 