Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <GL\glew.h>
- #include <GLFW/glfw3.h>
- #include <glm/glm/glm.hpp>
- #include <GL/glut.h>
- #include <stdlib.h>
- #include <cmath>
- #include <iostream>
- using namespace std;
- #define PI 3.14159265
- void elipsa(float r, float kat,float mx, float my, bool poziomo)
- {
- float rozmiar=360/kat;
- float przyrost = kat;
- if(poziomo==true)
- {
- swap(mx,my);
- }
- glBegin(GL_LINES);
- glColor3f(1,0,0);
- for(int i=0;i<rozmiar;i++)
- {
- //glVertex3f(mx*r*cos(kat),my*r*sin(kat),0);
- kat+=przyrost;
- glVertex3f(mx*r*cos(kat),my*r*sin(kat),0);
- }
- glEnd();
- }
- void rysunek3(float r,float kat)
- {
- float mx=0.3;
- float my=0.6;
- int ile=6;
- for(int i=0;i<ile;i++)
- {
- elipsa(r,kat,mx,my,0);
- elipsa(r,kat,mx,my,1);
- mx+=0.3;
- my+=0.3;
- }
- elipsa(r,kat,(ile+1)*0.3,(ile+1)*0.3,0);
- }
- void Display()
- {
- glClearColor(0,0,0,0);
- glClear(GL_COLOR_BUFFER_BIT);
- //elipsa(0.8,0.1,0.6,0.4,0);
- rysunek3(0.3,0.1);
- glFlush();
- glutSwapBuffers();
- }
- int _tmain(int argc, char* argv[])
- {
- glutInit( &argc, argv);
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
- glutInitWindowPosition(190,100);
- glutInitWindowSize(600 ,600);
- glutCreateWindow("lekcja2");
- glutDisplayFunc(Display);
- glMatrixMode(GL_PROJECTION);
- glutMainLoop();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment