|
void | initializeColors () |
|
void | PlotPixel (int x, int y) |
|
int | findOctant (int dx, int dy) |
|
tuple< int, int, int, int > | switchOctantToZero (int x1, int y1, int x2, int y2, int n) |
|
tuple< int, int > | switchOctantFromZero (int x1, int y1, int n) |
|
void | drawLine (int x1, int y1, int x2, int y2) |
|
void | draw_circle_octants (int x, int y, int x0, int y0) |
|
void | drawCircle (int x0, int y0, int r) |
|
void | drawStars (int W, int H, int count) |
|
void | drawGrass (int W) |
|
void | drawSunset (int W, int H) |
|
void | drawNightSky (int W, int H) |
|
void | fillCircle (int x, int y, int r) |
|
void | glConfig (int W, int H) |
|
void | Stayawake (GLFWwindow *window) |
|
void | setColor (double r, double g, double b) |
|
void | changePointSize (int psize) |
|
GLFWwindow * | StartWindow (int _h, int _w) |
|
void DrawUtil::changePointSize |
( |
int |
psize | ) |
|
|
inline |
void DrawUtil::draw_circle_octants |
( |
int |
x, |
|
|
int |
y, |
|
|
int |
x0, |
|
|
int |
y0 |
|
) |
| |
|
inline |
void PlotPixel(int x, int y)
Definition: DrawUtil.cpp:31
void DrawUtil::drawCircle |
( |
int |
x0, |
|
|
int |
y0, |
|
|
int |
r |
|
) |
| |
|
inline |
void draw_circle_octants(int x, int y, int x0, int y0)
Definition: DrawUtil.cpp:182
void PlotPixel(int x, int y)
Definition: DrawUtil.cpp:31
void DrawUtil::drawGrass |
( |
int |
W | ) |
|
|
inline |
254 int height = 5 + (rand() %
static_cast<int>(25 - 5 + 1));
void drawLine(int x1, int y1, int x2, int y2)
Definition: DrawUtil.cpp:124
void DrawUtil::drawLine |
( |
int |
x1, |
|
|
int |
y1, |
|
|
int |
x2, |
|
|
int |
y2 |
|
) |
| |
|
inline |
129 int ystart = y2 > y1 ? y1 : y2;
130 int yend = y2 > y1 ? y2 : y1;
131 while(ystart <= yend)
143 int d_param = 2*dy - dx;
146 int incr_NE = dy - dx;
tuple< int, int > switchOctantFromZero(int x1, int y1, int n)
Definition: DrawUtil.cpp:107
int findOctant(int dx, int dy)
Definition: DrawUtil.cpp:48
void PlotPixel(int x, int y)
Definition: DrawUtil.cpp:31
tuple< int, int, int, int > switchOctantToZero(int x1, int y1, int x2, int y2, int n)
Definition: DrawUtil.cpp:81
void DrawUtil::drawNightSky |
( |
int |
W, |
|
|
int |
H |
|
) |
| |
|
inline |
278 glColor3f(0.02,0.02,.20*j/H);
void drawLine(int x1, int y1, int x2, int y2)
Definition: DrawUtil.cpp:124
void DrawUtil::drawStars |
( |
int |
W, |
|
|
int |
H, |
|
|
int |
count |
|
) |
| |
|
inline |
238 int height = H - (rand() %
static_cast<int>(H - 100 + 1));
239 int x = (rand() %
static_cast<int>(W));
240 float intensity_factor = 1.0*float(height)/float(H);
241 glColor3f(intensity_factor, intensity_factor, intensity_factor);
void PlotPixel(int x, int y)
Definition: DrawUtil.cpp:31
void DrawUtil::drawSunset |
( |
int |
W, |
|
|
int |
H |
|
) |
| |
|
inline |
266 glColor3f(0.40,0.40*j/H,0);
void drawLine(int x1, int y1, int x2, int y2)
Definition: DrawUtil.cpp:124
void DrawUtil::fillCircle |
( |
int |
x, |
|
|
int |
y, |
|
|
int |
r |
|
) |
| |
|
inline |
void drawCircle(int x0, int y0, int r)
Definition: DrawUtil.cpp:196
int DrawUtil::findOctant |
( |
int |
dx, |
|
|
int |
dy |
|
) |
| |
|
inline |
53 if(dy>=0 && dy<=dx){octant = 0;}
54 else if(dy>=0 && dy>dx){octant = 1;}
55 else if(dy<0 && abs(dy)<=abs(dx)){octant = 7;}
60 if(dy>=0 && abs(dy) > abs(dx)){octant = 2;}
61 else if(dy>=0 && abs(dy) <= abs(dx)){octant = 3;}
62 else if(dy<0 && abs(dy)<=abs(dx)){octant = 4;}
void DrawUtil::glConfig |
( |
int |
W, |
|
|
int |
H |
|
) |
| |
|
inline |
296 const GLubyte* renderer = glGetString(GL_RENDERER);
297 const GLubyte* version = glGetString(GL_VERSION);
298 printf(
"Renderer: %s\n", renderer);
299 printf(
"OpenGL version supported %s\n", version);
301 glOrtho(0, W, 0, H, 0, 1);
void DrawUtil::initializeColors |
( |
| ) |
|
|
inline |
21 RGB c3(0.36,0.13,0.09);
22 RGB c4(.96,0.14,0.35);
RGB Colors[4]
Definition: DrawUtil.cpp:15
void DrawUtil::PlotPixel |
( |
int |
x, |
|
|
int |
y |
|
) |
| |
|
inline |
33 GLfloat pointerVertices[2];
34 pointerVertices[0] = x;
35 pointerVertices[1] = y;
36 glEnableClientState(GL_VERTEX_ARRAY);
37 glVertexPointer(2, GL_FLOAT, 0, pointerVertices);
38 glDrawArrays(GL_POINTS, 0, 1);
39 glDisableClientState(GL_VERTEX_ARRAY);
void DrawUtil::setColor |
( |
double |
r, |
|
|
double |
g, |
|
|
double |
b |
|
) |
| |
|
inline |
GLFWwindow* DrawUtil::StartWindow |
( |
int |
_h, |
|
|
int |
_w |
|
) |
| |
|
inline |
328 if(glfwInit() ==
false)
330 fprintf(stderr,
"Error initializing GLFW\n");
338 GLFWwindow* window = glfwCreateWindow(W, H,
"OpenGL Example", NULL, NULL);
342 fprintf(stderr,
"Error while creating a window\n");
347 glfwMakeContextCurrent(window);
void glConfig(int W, int H)
Definition: DrawUtil.cpp:294
void DrawUtil::Stayawake |
( |
GLFWwindow * |
window | ) |
|
|
inline |
308 while(!glfwWindowShouldClose(window))
310 glfwSwapBuffers(window);
314 glfwDestroyWindow(window);
tuple<int, int> DrawUtil::switchOctantFromZero |
( |
int |
x1, |
|
|
int |
y1, |
|
|
int |
n |
|
) |
| |
|
inline |
111 case 0:
return make_tuple(x1, y1);
112 case 1:
return make_tuple(y1, x1);
113 case 2:
return make_tuple(-y1, x1);
114 case 3:
return make_tuple(-x1, y1);
115 case 4:
return make_tuple(-x1, -y1);
116 case 5:
return make_tuple(-y1, -x1);
117 case 6:
return make_tuple(y1, -x1);
118 case 7:
return make_tuple(x1, -y1);
tuple<int, int, int, int> DrawUtil::switchOctantToZero |
( |
int |
x1, |
|
|
int |
y1, |
|
|
int |
x2, |
|
|
int |
y2, |
|
|
int |
n |
|
) |
| |
|
inline |
85 case 0:
return make_tuple(x1, y1, x2, y2);
86 case 1:
return make_tuple(y1, x1, y2, x2);
87 case 2:
return make_tuple(y1, -x1, y2, -x2);
88 case 3:
return make_tuple(-x1, y1, -x2, y2);
89 case 4:
return make_tuple(-x1, -y1, -x2, -y2);
90 case 5:
return make_tuple(-y1, -x1, -y2, -x2);
91 case 6:
return make_tuple(-y1, x1, -y2, x2);
92 case 7:
return make_tuple(x1, -y1, x2, -y2);
The documentation for this class was generated from the following file: