All pastes #469280 Raw Edit

Something

public cpp v1 · immutable
·published 2007-05-03 17:15 UTC
rendered paste body
#include <glut.h>#include <stdlib.h>#include "Vector2D.h"int w = 600;int h = 600;int n = 100000;int pickpt = 0;Vector2D p[3], P;void init(){	glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);	glClearColor(1.0, 1.0, 1.0, 0.0);	glColor3f(0.0, 0.0, 0.0);}void display(){	glClear(GL_COLOR_BUFFER_BIT);	for(int i=0; i<n; ++i){		pickpt = (int)rand() % 3;		P = 0.5*(P+p[pickpt]);		glBegin(GL_POINTS);			glVertex3f(P.x(), P.y(), 0.0);		glEnd();	}	glFlush();}int main(int argc, char** argv){	p[0].setXY(0, 0);	p[1].setXY(1, 0);	p[2].setXY(0.5, 1);	P = p[0];	glutInit(&argc, argv);	glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);	glutInitWindowSize(w, h);	glutInitWindowPosition(100,100);	glutCreateWindow("Aufgabe7: Sierpinski");	init();	glClear(GL_COLOR_BUFFER_BIT);	glutDisplayFunc(display);	glutMainLoop();	return 0;}