30.11.2012 Aufrufe

CG1-01-15.pdf

CG1-01-15.pdf

CG1-01-15.pdf

MEHR ANZEIGEN
WENIGER ANZEIGEN

Sie wollen auch ein ePaper? Erhöhen Sie die Reichweite Ihrer Titel.

YUMPU macht aus Druck-PDFs automatisch weboptimierte ePaper, die Google liebt.

22<br />

Programmierung<br />

Rahmenprogramm:<br />

static void myReshape<br />

(int w,int h)<br />

{glViewport(0,0,w,h);<br />

glMatrixMode(GL_PROJECTION);<br />

glLoadIdentity();<br />

gluOrtho2D(0.0,1.0,0.0,1.0);}<br />

2 0 0 0 0 0 0<br />

#include <br />

# #include /<br />

#include <br />

static void myinit<br />

(void) i<br />

{glClearColor (0.0,0.0,0.0,1.0);}<br />

void main(int argc,char** argv)<br />

{glutInitDisplayMode(GLUT_SINGLE|<br />

GLUT_RGB|GLUT_ALPHA|GLUT_DEPTH);<br />

| | )<br />

glutInitWindowPosition(0,0);<br />

glutInitWindowSize(500,500);<br />

glutInit(&argc,argv);<br />

glutCreateWindow(argv[0]);<br />

l C i d ( [0])<br />

myinit();<br />

glutReshapeFunc(myReshape);<br />

glutDisplayFunc(myDisplay);<br />

glutMainLoop();}<br />

l tM i L () }<br />

static void myDisplay<br />

( (void) id)<br />

{glMatrixMode(GL_MODELVIEW);<br />

glLoadIdentity();<br />

glClear(GL_COLOR_BUFFER_BIT);<br />

glColor3f(1,1,1);<br />

lC l 3f(1 1 1)<br />

glBegin(GL_LINE_LOOP);<br />

glVertex2f(0.25,0.25);<br />

glVertex2f(0.75,0.25);<br />

glVertex2f(0.75,0.75);<br />

lV t 2f(0 75 0 75)<br />

glVertex2f(0.25,0.75);<br />

glEnd();<br />

glFlush();}

Hurra! Ihre Datei wurde hochgeladen und ist bereit für die Veröffentlichung.

Erfolgreich gespeichert!

Leider ist etwas schief gelaufen!