rendered paste body#include<SDL/SDL.h>#include<SDL/SDL_opengl.h>#include<math.h>#include<time.h>SDL_Surface *naytto;double poten(double luku,int exp){ double kluku=luku; for(int i=0;i<exp-1;i++){ luku = luku*kluku; } return luku;}int main(int argc, char **argv){ naytto = SDL_SetVideoMode(600,400,32,SDL_OPENGL|SDL_DOUBLEBUF); srand(time(NULL)); int met = glGenLists(1); glNewList(met, GL_COMPILE); glBegin(GL_POINTS); for(int a=1;a<35;a++){ for(double i=0;i<100;i+=0.1){ glColor3f(0,0,100/poten(a,2)); glVertex2f(cos(i)*a,sin(i)*a); } } glEnd(); glEndList(); int met2 = glGenLists(1); glNewList(met2, GL_COMPILE); glBegin(GL_POINTS); for(int a=1;a<5;a++){ for(double i=0;i<50;i+=0.1){ glColor3f(1,1,1); glVertex2f(cos(i)*a,sin(i)*a); } } glEnd(); glEndList(); double sx = 0; double sy = 0; glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(-300,300,200,-200,-0.5,0); glMatrixMode(GL_MODELVIEW); SDL_Event e; bool paalla=true; while(paalla){ while(SDL_PollEvent(&e)){ if(e.type == SDL_QUIT) paalla = false; } glClear(GL_COLOR_BUFFER_BIT); glLoadIdentity(); glTranslatef(cos(sx/14)*100,sin(sy/14)*100,0); glCallList(met); glTranslatef(cos(sx/16)*40,sin(sy/16),0); glCallList(met2); glTranslatef(cos(sx/16),sin(sy/16)*40,0); glCallList(met2); SDL_GL_SwapBuffers(); SDL_Delay(20); sx+=rand()%2-2; sy+=rand()%2-2; sy = double(sx)/0.8; } SDL_Quit();return 0;}