Changes between Version 7 and Version 8 of lab-intro


Ignore:
Timestamp:
Feb 24, 2009, 12:48:32 PM (16 years ago)
Author:
msitar
Comment:

OpenGL primer

Legend:

Unmodified
Added
Removed
Modified
  • lab-intro

    v7 v8  
    183183== OpenGL primer ==
    184184
    185 
     185Primer minimalnega programa, ki izriše črto:
     186{{{
     187#!c
     188#include <GL/glut.h>
     189
     190void 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
     201int 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
     212Za prevod te kode uporabimo ukaz {{{cc minimalni_program.c -lglut}}} , kjer z ''lglut'' povemo, da imamo vključeno knjižnico ''glut''.
     213
     214