Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "PieChart.h"
- #include <Windows.h>
- #include <gl/GL.h>
- #include <math.h>
- PieChart::PieChart()
- {
- }
- PieChart::~PieChart()
- {
- }
- void PieChart::Render()
- {
- glEnable(GL_BLEND);
- glEnable(GL_POLYGON_SMOOTH);
- glShadeModel(GL_FLAT);
- glBegin(GL_TRIANGLE_FAN);
- //center of fan
- glVertex2f(0.0f, 0.0f);
- for (angle = 0.0f; angle <= (25.0f * GL_PI); angle += (GL_PI / 30.0f))
- {
- //calculate x and y position of the next vertex
- y = 300.0f*sin(angle);
- x = 300.0f*cos(angle);
- //alternate colours
- if (pivot)
- {
- pivot = false;
- glColor3f(1.0f, .0f, 0.0f);
- }
- else
- {
- pivot = true;
- glColor3f(0.0f, 0.0f, 1.0f);
- }
- //specify the next vertex
- glVertex2f(x, y);
- }
- glEnd();
- }
- bool PieChart::MouseMove(int x, int y)
- {
- return true;
- }
- bool PieChart::MouseLBUp(int x, int y)
- {
- return true;
- }
- bool PieChart::MouseLBDown(int x, int y)
- {
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement