185 | | |
| 185 | Primer minimalnega programa, ki izriše črto: |
| 186 | {{{ |
| 187 | #!c |
| 188 | #include <GL/glut.h> |
| 189 | |
| 190 | void display() |
| 191 | { |
| 192 | glClear(GL_COLOR_BUFFER_BIT); |
| 193 | glColor3f(1.0, 0.4, 1.0); |
| 194 | glBegin(GL_LINES); |
| 195 | glVertex2f(0.1, 0.1); |
| 196 | glVertex3f(0.8, 0.8, 1.0); |
| 197 | glEnd(); |
| 198 | glFlush(); |
| 199 | } |
| 200 | |
| 201 | int main(int argc, char *argv[]) |
| 202 | { |
| 203 | glutInit(&argc,argv); |
| 204 | glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); |
| 205 | glutCreateWindow("C GLUT program"); |
| 206 | glutDisplayFunc(display); |
| 207 | glutMainLoop(); |
| 208 | return 0; |
| 209 | } |
| 210 | }}} |
| 211 | |
| 212 | Za prevod te kode uporabimo ukaz {{{cc minimalni_program.c -lglut}}} , kjer z ''lglut'' povemo, da imamo vključeno knjižnico ''glut''. |
| 213 | |
| 214 | |