-
Notifications
You must be signed in to change notification settings - Fork 0
/
Painter.cpp
executable file
·620 lines (439 loc) · 19.6 KB
/
Painter.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
/*
* File: Painter.cpp
* Author: scribble
*
* Created on October 24, 2012, 10:15 AM
*/
//#include <FTGL/FTGLPixmapFont.h>
#include "Painter.h"
#include "Loading.h"
using namespace poppler;
Painter::Painter() {
scribbleArea = new ScribbleArea(0, 50, WIDTH, HEIGHT - 50);
menu = new Menu(0, 0, WIDTH, 50);
login = new Login(WIDTH / 2 - 656 / 2, HEIGHT / 2 - 387 / 2, 656, 387);
filelist = new FileList(WIDTH / 2 - 656 / 2, HEIGHT / 2 - 738 / 2, 656, 738);
colorPicker = new ColorPicker(168, 44, 253, 121);
sizePicker = new SizePicker(124, 44, 253, 121);
alert = new Alert("", "", -1);
loading = new Loading();
interpreter = new ScreenInterpreter(scribbleArea, menu, login, filelist, colorPicker, sizePicker, alert);
menu->setScreenInterpreter(interpreter);
login->setScreenInterpreter(interpreter);
filelist->setScreenInterpreter(interpreter);
colorPicker->setScreenInterpreter(interpreter);
sizePicker->setScreenInterpreter(interpreter);
alert ->setScreenInterpreter(interpreter);
}
Painter::Painter(const Painter& orig) {
}
Painter::~Painter() {
delete scribbleArea;
delete menu;
delete login;
delete interpreter;
delete colorPicker;
delete sizePicker;
//delete keyboard;
delete alert;
}
ScribbleArea* Painter::getScribbleArea() {
return scribbleArea;
}
Menu* Painter::getMenu() {
return menu;
}
Login* Painter::getLogin() {
return login;
}
Keyboard* Painter::getKeyboard() {
return keyboard;
}
FileList* Painter::getFileList() {
return filelist;
}
ScreenInterpreter* Painter::getInterpreter() {
return interpreter;
}
void Painter::Draw() {
try {
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
if (interpreter->getShowLogin() == 1) {
drawLogin();
} else if (interpreter->getShowFile() == 1) {
drawFileList();
} else {
drawPDF();
glEnable(GL_LINE_SMOOTH);
glEnable(GL_POINT_SMOOTH);
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
drawPaths();
drawMenu();
if (interpreter->getShowColorPicker() == 1) {
drawColorPicker();
}
if (interpreter->getShowSizePicker() == 1) {
drawSizePicker();
}
glDisable(GL_LINE_SMOOTH);
glDisable(GL_POINT_SMOOTH);
}
if (interpreter->getShowAlert() == 1) {
drawAlert();
}
if (interpreter->getShowLoading() == 1) {
drawLoading();
}
glDisable(GL_BLEND);
} catch (...) {
std::cout << "ERROR";
scribbleArea->setLockForNetworkPath(0);
scribbleArea->setLockForPath(0);
scribbleArea->setLockForTempPath(0);
//return;
}
}
void Painter::drawPaths() {
scribbleArea->setLockForPath(1);
for (int i = 0; i < scribbleArea->getPathsOnPage().at(scribbleArea->getCurrentPage()).size(); ++i) {
glColor3f(scribbleArea->getPathsOnPage().at(scribbleArea->getCurrentPage()).at(i)->getPenColor().getRed(), scribbleArea->getPathsOnPage().at(scribbleArea->getCurrentPage()).at(i)->getPenColor().getGreen(), scribbleArea->getPathsOnPage().at(scribbleArea->getCurrentPage()).at(i)->getPenColor().getBlue());
glLineWidth(scribbleArea->getPathsOnPage().at(scribbleArea->getCurrentPage()).at(i)->getPenWidth());
/*glEnableClientState( GL_VERTEX_ARRAY );
glVertexPointer(2,GL_INT,0,scribbleArea->getPathsOnPage().at(scribbleArea->getCurrentPage()).at(i)->pointsArray());
glDrawArrays(GL_QUADS,0,2*scribbleArea->getPathsOnPage().at(scribbleArea->getCurrentPage()).at(i)->getPointsCount());
*/
glBegin(GL_LINE_STRIP);
for (int j = 0; j < scribbleArea->getPathsOnPage().at(scribbleArea->getCurrentPage()).at(i)->getPath().size(); ++j) {
glVertex3f(scribbleArea->getPathsOnPage().at(scribbleArea->getCurrentPage()).at(i)->getPath().at(j)->getX(), scribbleArea->getPathsOnPage().at(scribbleArea->getCurrentPage()).at(i)->getPath().at(j)->getY(), 0.0f);
}
glEnd();
if (scribbleArea->getPathsOnPage().at(scribbleArea->getCurrentPage()).at(i)->getPenWidth() > 2) {
glPointSize(scribbleArea->getPathsOnPage().at(scribbleArea->getCurrentPage()).at(i)->getPenWidth() - 1);
glBegin(GL_POINTS);
for (int j = 0; j < scribbleArea->getPathsOnPage().at(scribbleArea->getCurrentPage()).at(i)->getPath().size(); ++j) {
glVertex3f(scribbleArea->getPathsOnPage().at(scribbleArea->getCurrentPage()).at(i)->getPath().at(j)->getX(), scribbleArea->getPathsOnPage().at(scribbleArea->getCurrentPage()).at(i)->getPath().at(j)->getY(), 0.0f);
}
glEnd();
}
}
scribbleArea->setLockForPath(0);
scribbleArea->setLockForTempPath(1);
if (scribbleArea->getTempPath() != NULL) {
glColor3f(scribbleArea->getTempPath()->getPenColor().getRed(), scribbleArea->getTempPath()->getPenColor().getGreen(), scribbleArea->getTempPath()->getPenColor().getBlue());
glLineWidth(scribbleArea->getTempPath()->getPenWidth());
glBegin(GL_LINE_STRIP);
for (int j = 0; j < scribbleArea->getTempPath()->getPath().size(); ++j) {
glVertex3f(scribbleArea->getTempPath()->getPath().at(j)->getX(), scribbleArea->getTempPath()->getPath().at(j)->getY(), 0.0f);
}
glEnd();
if (scribbleArea->getTempPath()->getPenWidth() > 2) {
glPointSize(scribbleArea->getTempPath()->getPenWidth() - 1);
glBegin(GL_POINTS);
for (int j = 0; j < scribbleArea->getTempPath()->getPath().size(); ++j) {
glVertex3f(scribbleArea->getTempPath()->getPath().at(j)->getX(), scribbleArea->getTempPath()->getPath().at(j)->getY(), 0.0f);
}
glEnd();
}
}
scribbleArea->setLockForTempPath(0);
//Path that is being received through the network
scribbleArea->setLockForNetworkPath(1);
if (scribbleArea->getCurrentPage() == scribbleArea->getNetworkPage() && scribbleArea->getNetworkPath() != NULL) {
glColor3f(scribbleArea->getNetworkPath()->getPenColor().getRed(), scribbleArea->getNetworkPath()->getPenColor().getGreen(), scribbleArea->getNetworkPath()->getPenColor().getBlue());
glLineWidth(scribbleArea->getNetworkPath()->getPenWidth());
glBegin(GL_LINE_STRIP);
for (int j = 0; j < scribbleArea->getNetworkPath()->getPath().size(); ++j) {
glVertex3f(scribbleArea->getNetworkPath()->getPath().at(j)->getX(), scribbleArea->getNetworkPath()->getPath().at(j)->getY(), 0.0f);
}
glEnd();
if (scribbleArea->getNetworkPath()->getPenWidth() > 2) {
glPointSize(scribbleArea->getNetworkPath()->getPenWidth() - 1);
glBegin(GL_POINTS);
for (int j = 0; j < scribbleArea->getNetworkPath()->getPath().size(); ++j) {
glVertex3f(scribbleArea->getNetworkPath()->getPath().at(j)->getX(), scribbleArea->getNetworkPath()->getPath().at(j)->getY(), 0.0f);
}
glEnd();
}
}
scribbleArea->setLockForNetworkPath(0);
}
void Painter::drawMenu() {
getPNG(menu->getBackground(), menu->getX(), menu->getY());
for (int i = 0; i < menu->getButtonArray()->size(); ++i) {
int btnx = menu->getX() + menu->getButtonArray()->at(i)->getX();
int btny = menu->getY() + menu->getButtonArray()->at(i)->getY();
getPNG(menu->getButtonArray()->at(i)->getImagePath(), btnx, btny);
}
std::string ownershipImage;
int ownership = scribbleArea->getOwnershipValue();
if (ownership == 0) { //ME
//release it since I already have it
ownershipImage = "OwnershipMine.png";
} else if (ownership == 1) { //Taken
//busy
ownershipImage = "OwnershipTaken.png";
} else if (ownership == 2) { //Free
//send to get it
ownershipImage = "GetOwnership.png";
} else {
std::cout << "ERROR WITH OWNERSHIP\n";
}
ownershipImage.insert(0, IMAGE_PATH);
menu->getOwnershipBTN()->setImagePath(ownershipImage);
getPNG(menu->getOwnershipBTN()->getImagePath(), menu->getOwnershipBTN()->getX(), menu->getOwnershipBTN()->getY());
glColor3f(Color(DARK_GRAY).getRed(), Color(DARK_GRAY).getGreen(), Color(DARK_GRAY).getBlue());
glPixelZoom(1.0, 1.0);
// Create a pixmap font from a TrueType file.
FTGLPixmapFont font("./resources/fonts/century_gothic.ttf");
// If something went wrong, bail out.
if (font.Error())
std::cout << "ERROR: FONT WAS NOT LOADED\n";
// Set the font size and render a small text.
font.FaceSize(25);
float width = font.Advance(menu->getPageIndicator().c_str(), -1, FTPoint());
float height = font.LineHeight();
glRasterPos2i(WIDTH - width - (44 + 5)*2, height);
font.Render(menu->getPageIndicator().c_str(), -1, FTPoint(), FTPoint(), FTGL::RENDER_ALL);
}
void Painter::drawAlert() {
getPNG(alert->getImagePath(), alert->getX(), alert->getY());
for (int i = 0; i < alert->getButtonArray()->size(); ++i) {
int btnx = alert->getButtonArray()->at(i)->getX();
int btny = alert->getButtonArray()->at(i)->getY();
getPNG(alert->getButtonArray()->at(i)->getImagePath(), btnx, btny);
}
glColor3f(Color(DARK_GRAY).getRed(), Color(DARK_GRAY).getGreen(), Color(DARK_GRAY).getBlue());
glPixelZoom(1.0, 1.0);
FTPixmapFont *font = new FTPixmapFont("./resources/fonts/century_gothic.ttf");
// If something went wrong, bail out.
if (font->Error())
std::cout << "ERROR: FONT WAS NOT LOADED\n";
// Set the font size and render a small text.
font->FaceSize(35);
float width = font->Advance(alert->getTitle().c_str(), -1, FTPoint());
float height = font->LineHeight();
glRasterPos2i((alert->getX() + alert->getWidth() / 2)-(width / 2), alert->getY() + height - 5);
font->Render(alert->getTitle().c_str(), -1, FTPoint(), FTPoint(), FTGL::RENDER_ALL);
FTSimpleLayout layout;
layout.SetFont(font);
layout.SetAlignment(FTGL::ALIGN_CENTER);
layout.SetLineLength(500);
glRasterPos2i((alert->getX() + alert->getWidth() / 2)-(layout.GetLineLength() / 2), alert->getY() + 140 / 2 + layout.GetFont()->LineHeight());
layout.Render(alert->getMessage().c_str(), -1, FTPoint(), FTGL::RENDER_ALL);
// Set the font size and render a small text.
delete font;
}
void Painter::drawPDF() {
//#warning //add centering and scaling
glPixelZoom(1.0, -1.0);
char *_image = scribbleArea->getDocument()->getImage()->data();
int _x = scribbleArea->getDocument()->getX();
int _y = scribbleArea->getDocument()->getY();
int width = scribbleArea->getDocument()->getImage()->width();
int height = scribbleArea->getDocument()->getImage()->height();
if (GL_FUCKUP == 0) {
glRasterPos2f(_x, _y);
glDrawPixels(width, height, GL_BGRA, GL_UNSIGNED_BYTE, &_image[0]);
} else {
drawPixels(_x, _y, width, height, _image);
}
}
void Painter::drawLogin() {
getPNG(login->getImagePath(), login->getX(), login->getY());
if (login->getTypingPassword() == 1) {
drawText(login->getUserName(), 35, login->getX() + 78, login->getY() + 128, Color(DARK_GRAY));
drawText(login->getPassword(), 35, login->getX() + 78, login->getY() + 205, Color(GREEN));
}
else if (login->getTypingUser() == 1) {
drawText(login->getUserName(), 35, login->getX() + 78, login->getY() + 128, Color(GREEN));
drawText(login->getPassword(), 35, login->getX() + 78, login->getY() + 205, Color(DARK_GRAY));
}
else {
drawText(login->getUserName(), 35, login->getX() + 78, login->getY() + 128, Color(DARK_GRAY));
drawText(login->getPassword(), 35, login->getX() + 78, login->getY() + 205, Color(DARK_GRAY));
}
}
void Painter::drawKeyboard() {
}
void Painter::drawFileList() {
getPNG(filelist->getImagePath(), filelist->getX(), filelist->getY());
for (int i = 0; i < filelist->getButtonArray()->size(); ++i) {
int x = filelist->getButtonArray()->at(i)->getX();
int y = filelist->getButtonArray()->at(i)->getY();
glRasterPos2i(x, y);
getPNG(filelist->getButtonArray()->at(i)->getImagePath(), x, y);
}
for (int i = 0; i < filelist->getFileListTable()->size(); ++i) {
int x = filelist->getFileListTable()->at(i)->getX();
int y = filelist->getFileListTable()->at(i)->getY();
glRasterPos2i(x, y);
getPNG(filelist->getFileListTable()->at(i)->getImagePath(), x, y);
drawText(filelist->getFileListTable()->at(i)->getFileName(), 25, x + 56, y + 20, Color(DARK_GRAY));
}
std::string page;
page = "Page " + filelist->getCurrentPage() + "/" + filelist->getNumberOfPages();
drawText(page, 35, filelist->getX() + 18, filelist->getY() + 690, Color(GREEN));
}
void Painter::drawColorPicker() {
getPNG(colorPicker->getImagePath(), colorPicker->getX(), colorPicker->getY());
for (int i = 0; i < colorPicker->getButtonArray()->size(); ++i) {
int btnx = colorPicker->getButtonArray()->at(i)->getX();
int btny = colorPicker->getButtonArray()->at(i)->getY();
getPNG(colorPicker->getButtonArray()->at(i)->getImagePath(), btnx, btny);
}
}
void Painter::drawSizePicker() {
getPNG(sizePicker->getImagePath(), sizePicker->getX(), sizePicker->getY());
for (int i = 0; i < sizePicker->getButtonArray()->size(); ++i) {
int btnx = sizePicker->getButtonArray()->at(i)->getX();
int btny = sizePicker->getButtonArray()->at(i)->getY();
getPNG(sizePicker->getButtonArray()->at(i)->getImagePath(), btnx, btny);
}
}
void Painter::getPNG(std::string imagePath, int _x, int _y) {
//decode
glPixelZoom(1.0, -1.0);
std::vector<unsigned char> image; //the raw pixels
unsigned width, height;
unsigned error = lodepng::decode(image, width, height, imagePath);
if (error) {
return;
}
if (GL_FUCKUP == 0) {
glRasterPos2i(_x, _y);
glDrawPixels(width, height, GL_RGBA, GL_UNSIGNED_BYTE, &image[0]);
} else {
drawPixels(_x, _y, width, height, image);
}
}
void Painter::drawPixels(int _x, int _y, int width, int height, std::vector<unsigned char> _image) {
// Texture size must be power of two for the primitive OpenGL version this is written for. Find next power of two.
size_t u2 = 1;
while (u2 < width) u2 *= 2;
size_t v2 = 1;
while (v2 < height) v2 *= 2;
// Ratio for power of two version compared to actual version, to render the non power of two image with proper size.
double u3 = (double) width / u2;
double v3 = (double) height / v2;
// Make power of two version of the image.
std::vector<unsigned char> image2(u2 * v2 * 4);
for (size_t y = 0; y < height; ++y) {
for (size_t x = 0; x < width; ++x) {
image2[4 * u2 * y + 4 * x + 0] = _image[4 * width * y + 4 * x + 0];
image2[4 * u2 * y + 4 * x + 1] = _image[4 * width * y + 4 * x + 1];
image2[4 * u2 * y + 4 * x + 2] = _image[4 * width * y + 4 * x + 2];
image2[4 * u2 * y + 4 * x + 3] = _image[4 * width * y + 4 * x + 3];
}
}
glColor3f(1.0, 1.0, 1.0);
// Enable the texture for OpenGL.
glEnable(GL_TEXTURE_2D);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); //GL_NEAREST = no smoothing
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, 4, u2, v2, 0, GL_RGBA, GL_UNSIGNED_BYTE, &image2[0]);
// Draw the texture on a quad, using u3 and v3 to correct non power of two texture size.
glBegin(GL_QUADS);
glTexCoord2d(0, 0);
glVertex2f(_x, _y);
glTexCoord2d(u3, 0);
glVertex2f(width + _x, _y);
glTexCoord2d(u3, v3);
glVertex2f(width + _x, height + _y);
glTexCoord2d(0, v3);
glVertex2f(_x, height + _y);
glEnd();
glDisable(GL_TEXTURE_2D);
}
void Painter::drawPixels(int _x, int _y, int width, int height, char* _image) {
// Texture size must be power of two for the primitive OpenGL version this is written for. Find next power of two.
size_t u2 = 1;
while (u2 < width) u2 *= 2;
size_t v2 = 1;
while (v2 < height) v2 *= 2;
// Ratio for power of two version compared to actual version, to render the non power of two image with proper size.
double u3 = (double) width / u2;
double v3 = (double) height / v2;
// Make power of two version of the image.
std::vector<unsigned char> image2(u2 * v2 * 4);
for (size_t y = 0; y < height; ++y) {
for (size_t x = 0; x < width; ++x) {
image2[4 * u2 * y + 4 * x + 0] = _image[4 * width * y + 4 * x + 0];
image2[4 * u2 * y + 4 * x + 1] = _image[4 * width * y + 4 * x + 1];
image2[4 * u2 * y + 4 * x + 2] = _image[4 * width * y + 4 * x + 2];
image2[4 * u2 * y + 4 * x + 3] = _image[4 * width * y + 4 * x + 3];
}
}
glColor3f(1.0, 1.0, 1.0);
// Enable the texture for OpenGL.
glEnable(GL_TEXTURE_2D);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); //GL_NEAREST = no smoothing
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, 4, u2, v2, 0, GL_BGRA, GL_UNSIGNED_BYTE, &image2[0]);
// Draw the texture on a quad, using u3 and v3 to correct non power of two texture size.
glBegin(GL_QUADS);
glTexCoord2d(0, 0);
glVertex2f(_x, _y);
glTexCoord2d(u3, 0);
glVertex2f(width + _x, _y);
glTexCoord2d(u3, v3);
glVertex2f(width + _x, height + _y);
glTexCoord2d(0, v3);
glVertex2f(_x, height + _y);
glEnd();
glDisable(GL_TEXTURE_2D);
}
void Painter::drawText(std::string text, int size, int x, int y, Color color) {
glColor3f(color.getRed(), color.getGreen(), color.getBlue());
glPixelZoom(1.0, 1.0);
glRasterPos2i(x, y + size - 5);
// Create a pixmap font from a TrueType file.
FTGLPixmapFont font("./resources/fonts/century_gothic.ttf");
// If something went wrong, bail out.
if (font.Error())
std::cout << "ERROR: FONT WAS NOT LOADED\n";
// Set the font size and render a small text.
font.FaceSize(size);
font.Render(text.c_str(), -1, FTPoint(), FTPoint(), FTGL::RENDER_ALL);
}
void Painter::drawLoading() {
getPNG(loading->getBackground(), (WIDTH / 2) - (150 / 2), (HEIGHT / 2) - (150 / 2));
int x = (WIDTH / 2) - (90 / 2);
int y = (HEIGHT / 2) - (90 / 2);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glTranslatef((WIDTH / 2), (HEIGHT / 2), 0.0);
glRotatef(loading->getTopAngle(), 0.0, 0.0, 1.0);
glTranslatef(-(WIDTH / 2), -(HEIGHT / 2), 0.0);
//getPNG(loading->getTopRing(), x, y);
glPixelZoom(1.0, -1.0);
std::vector<unsigned char> image_1; //the raw pixels
unsigned width_1, height_1;
unsigned error1 = lodepng::decode(image_1, width_1, height_1, loading->getTopRing());
if (error1) {
return;
}
drawPixels(x, y, width_1, height_1, image_1);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glTranslatef((WIDTH / 2), (HEIGHT / 2), 0.0);
glRotatef(loading->getBottomAngle(), 0.0, 0.0, 1.0);
glTranslatef(-(WIDTH / 2), -(HEIGHT / 2), 0.0);
//getPNG(loading->getBottomRing(), x, y);
glPixelZoom(1.0, -1.0);
std::vector<unsigned char> image_2; //the raw pixels
unsigned width_2, height_2;
unsigned error2 = lodepng::decode(image_2, width_2, height_2, loading->getBottomRing());
if (error2) {
return;
}
drawPixels(x, y, width_2, height_2, image_2);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
loading->setTopAngle();
loading->setBottomAngle();
}