my code is:
void display() {
glColor3f(1.0f, 0.0f, 0.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0, 0, 1.2, 0, 0, 0, 0, 1, 0);
glRotatef(30,0,0,1);
glBegin(GL_TRIANGLES); // Start Drawing The Pyramid
glColor3f(0.0f, 1.0f, 0.0f); // Red
glVertex3f(-1.0f, 1.0f, 0.0f); // Top Of Triangle (Front)
glVertex3f(-1.0f, -1.0f, 0.0f); // Left Of Triangle (Front)
glVertex3f(1.0f, -1.0f, 0.0f); // Right Of Triangle (Front)
glVertex3f(-1.0f, 1.0f, 0.0f); // Top Of Triangle (Right)
glVertex3f(1.0f, -1.0f, 0.0f); // Left Of Triangle (Right)
glVertex3f(1.0f, 1.0f, 0.0f);
glEnd();
glFlush();
glutSwapBuffers();
}
void init(void)
{
/* Setup cube vertex data. */
/* Use depth buffering for hidden surface elimination. */
glDisable( GL_DEPTH_TEST ) ;
glClearColor( 1.0, 1.0, 1.0, 0.0 ) ; // white
glClear( GL_COLOR_BUFFER_BIT ) ;
float mulval = 0.01 ; // you might want to change this
glEnable( GL_BLEND ) ;
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ) ; // works fine, except cracks
//glBlendFunc( GL_SRC_ALPHA_SATURATE, GL_ONE ) ; // works only on black background...
glPolygonMode( GL_FRONT, GL_FILL ) ;
glEnable( GL_POLYGON_SMOOTH ) ;
glHint( GL_POLYGON_SMOOTH_HINT, GL_NICEST ) ;
}
int main(int argc, char** argv) {
// Use a single buffered window in RGB mode (as opposed to a double-buffered
// window or color-index mode).
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB |GLUT_DEPTH | GLUT_STENCIL);
// Position window at (80,80)-(480,380) and give it a title.
glutInitWindowPosition(80, 80);
glutInitWindowSize(800, 600);
glutCreateWindow("A Simple Triangle");
// Tell GLUT that whenever the main window needs to be repainted that it
// should call the function display().
glutDisplayFunc(display);
glutReshapeFunc(reshape);
// Tell GLUT to start reading and processing events. This function
// never returns; the program only exits when the user closes the main
// window or kills the process.
init();
glutMainLoop();
return 0;
}
and result is:
[ATTACH=CONFIG]1266[/ATTACH]
what is the line between of triangle? i want to remove it!!