1 |
jakw |
1 |
|
|
|
2 |
#include <iostream>
|
|
|
3 |
//#include <unistd.h>
|
|
|
4 |
#include <stdio.h>
|
|
|
5 |
#include <QTime>
|
|
|
6 |
#include <QTest>
|
|
|
7 |
|
|
|
8 |
#include "OpenGLContext.h"
|
|
|
9 |
#include "ProjectorOpenGL.h"
|
|
|
10 |
|
|
|
11 |
|
|
|
12 |
int main(){
|
|
|
13 |
|
|
|
14 |
// Get screeninfo for OpenGL projector
|
|
|
15 |
std::vector<ScreenInfo> screenInfo;
|
|
|
16 |
screenInfo = OpenGLContext::GetScreenInfo();
|
|
|
17 |
|
|
|
18 |
for (unsigned int i=0; i<screenInfo.size(); i++) {
|
|
|
19 |
printf("Screen %d: width %d, height %d\n", i, screenInfo[i].resX, screenInfo[i].resY);
|
|
|
20 |
}
|
|
|
21 |
|
|
|
22 |
// Fill stripe texture
|
|
|
23 |
unsigned char stripeImage[200][200][3];
|
|
|
24 |
for (int k=0; k<3; k++) {
|
|
|
25 |
for (int i = 0; i < 200; i++) {
|
|
|
26 |
for (int j = 0; j < 101; j++) {
|
|
|
27 |
stripeImage[i][j][k] = 50;
|
|
|
28 |
}
|
|
|
29 |
for (int j = 101; j < 200; j++) {
|
|
|
30 |
stripeImage[i][j][k] = 100;
|
|
|
31 |
}
|
|
|
32 |
}
|
|
|
33 |
}
|
|
|
34 |
|
|
|
35 |
// Fill gray texture
|
|
|
36 |
unsigned char grayImage[200][200][3];
|
|
|
37 |
for (int k=0; k<3; k++) {
|
|
|
38 |
for (int i = 0; i < 200; i++) {
|
|
|
39 |
for (int j = 0; j < 200; j++) {
|
|
|
40 |
grayImage[i][j][k] = 50;
|
|
|
41 |
}
|
|
|
42 |
}
|
|
|
43 |
}
|
|
|
44 |
|
|
|
45 |
QTime time; time.start();
|
|
|
46 |
|
|
|
47 |
ProjectorOpenGL *PP = new ProjectorOpenGL(1);
|
|
|
48 |
|
|
|
49 |
std::cout << "Displaying texture" << std::endl;
|
|
|
50 |
time.restart();
|
|
|
51 |
PP->displayTexture((unsigned char*)stripeImage, 200, 200);
|
|
|
52 |
QTest::qSleep(2000);
|
|
|
53 |
unsigned int msecelapsed = time.restart();
|
|
|
54 |
std::cout << msecelapsed << std::endl;
|
|
|
55 |
|
|
|
56 |
std::cout << "Displaying white and black..." << std::endl;
|
|
|
57 |
for(unsigned int i = 0; i<3000; i++){
|
|
|
58 |
time.restart();
|
|
|
59 |
PP->displayWhite();
|
|
|
60 |
PP->displayBlack();
|
|
|
61 |
unsigned int msecelapsed = time.restart();
|
|
|
62 |
std::cout << msecelapsed << std::endl;
|
|
|
63 |
}
|
|
|
64 |
|
|
|
65 |
// std::cout << "Defining pattern sequence..." << std::endl;
|
|
|
66 |
// PP->setPattern(0, (unsigned char*)stripeImage, 200, 200);
|
|
|
67 |
// PP->setPattern(1, (unsigned char*)grayImage, 200, 200);
|
|
|
68 |
// std::cout << "Cycling through pattern sequence..." << std::endl;
|
|
|
69 |
// for(unsigned int i = 0; i<10000; i++){
|
|
|
70 |
// time.restart();
|
|
|
71 |
// PP->displayPattern(i%2);
|
|
|
72 |
// //QTest::qSleep(500);
|
|
|
73 |
// unsigned int msecelapsed = time.restart();
|
|
|
74 |
// std::cout << msecelapsed << std::endl;
|
|
|
75 |
// }
|
|
|
76 |
|
|
|
77 |
delete PP;
|
|
|
78 |
return 0;
|
|
|
79 |
}
|
|
|
80 |
|