Presentation is loading. Please wait.

Presentation is loading. Please wait.

#include int line_width = 1; void Display( void ) { glEnable( GL_LINE_STIPPLE ); glClearColor (0.0, 0.0, 0.0, 0.0); glClear(GL_COLOR_BUFFER_BIT);

Similar presentations


Presentation on theme: "#include int line_width = 1; void Display( void ) { glEnable( GL_LINE_STIPPLE ); glClearColor (0.0, 0.0, 0.0, 0.0); glClear(GL_COLOR_BUFFER_BIT);"— Presentation transcript:

1

2

3

4

5 #include int line_width = 1; void Display( void ) { glEnable( GL_LINE_STIPPLE ); glClearColor (0.0, 0.0, 0.0, 0.0); glClear(GL_COLOR_BUFFER_BIT); glColor3f(1.0, 1.0, 1.0); glMatrixMode (GL_PROJECTION); glLoadIdentity (); glOrtho(0.0, 5.0, 0.0, 5.0, -1.0, 1.0); glLineWidth( line_width ); glBegin(GL_LINES); glVertex2f( 1, 2.5 ); glVertex2f( 4, 2.5 ); glEnd(); glFlush(); } void Menu( int entry ) { glLineStipple( 1, (short) entry ); glutPostRedisplay(); } void Keyboard( unsigned char key, int x, int y ) { if (key == '+'){ line_width++; glutPostRedisplay(); } if (key == '-'){ if (line_width > 1){ line_width--; glutPostRedisplay(); } if (key == 'q' || key == 'Q'){ exit(0); } int main(int argc, char* argv[]) { glutInit(&argc, argv); glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); glutInitWindowSize (250, 250); glutInitWindowPosition (100, 100); glutCreateWindow ("lines"); glutDisplayFunc(Display); glutKeyboardFunc(Keyboard); glutCreateMenu(Menu); glutAddMenuEntry( "Dotted (0x0101)", 0x0101 ); glutAddMenuEntry( "Dashed (0x00FF)", 0x00FF ); glutAddMenuEntry( "Dot Dash Dot (0x1C47)", 0x1C47 ); glutAttachMenu( GLUT_RIGHT_BUTTON ); glutMainLoop(); return 0; }


Download ppt "#include int line_width = 1; void Display( void ) { glEnable( GL_LINE_STIPPLE ); glClearColor (0.0, 0.0, 0.0, 0.0); glClear(GL_COLOR_BUFFER_BIT);"

Similar presentations


Ads by Google