summaryrefslogtreecommitdiff
path: root/2004/i/nono/src/ovision/adjust.cc
diff options
context:
space:
mode:
Diffstat (limited to '2004/i/nono/src/ovision/adjust.cc')
-rw-r--r--2004/i/nono/src/ovision/adjust.cc43
1 files changed, 35 insertions, 8 deletions
diff --git a/2004/i/nono/src/ovision/adjust.cc b/2004/i/nono/src/ovision/adjust.cc
index f4b7b06..fa0b448 100644
--- a/2004/i/nono/src/ovision/adjust.cc
+++ b/2004/i/nono/src/ovision/adjust.cc
@@ -12,6 +12,9 @@
using namespace std;
+#define IMG_WIDTH 360
+#define IMG_HEIGHT 296
+
int window;
Comm *comm;
int point[3][2] = {{-1,-1},{-1,-1},{-1,-1}};
@@ -208,9 +211,17 @@ DrawGLScene()
for (int i=0; i<3; i++)
{
if (point[i][0] >= 0)
+/* x = (int)((double)WIDTH/width * x);
+ y = height - y;
+ y = (int)((double)HEIGHT/height * y);*/
glBegin(GL_POINTS);
- glVertex3f(point[i][0], point[i][1], -0.9f);
+ glVertex3f(point[i][0] * 352 / IMG_WIDTH + BORDER,
+ point[i][1] * 288 / IMG_HEIGHT + 3 * BORDER ,
+ -0.9f);
glEnd();
+
+ std::cout << point[i][0] * 352 / IMG_WIDTH + BORDER << " " <<
+ point[i][1] * 288 / IMG_HEIGHT + 3 * BORDER << endl;
}
glEnable(GL_TEXTURE_2D);
@@ -244,10 +255,27 @@ MouseFunc(int button, int state, int x, int y)
x = (int)((double)WIDTH/width * x);
y = height - y;
y = (int)((double)HEIGHT/height * y);
+ int imgX = -1;
+ int imgY = -1;
+ if ((x < 352+BORDER) && (y < BORDER+288) && (x > BORDER) && (y > BORDER))
+ {
+ imgX = x * IMG_WIDTH / 352 - BORDER;
+ imgY = y * IMG_HEIGHT / 288 - BORDER;
+
+ }
+
if ((x < 352+BORDER) && (y < HEIGHT-BORDER) && (x > BORDER) && (y > 2*BORDER+288))
{
- int i=0;
+ imgX = x * IMG_WIDTH / 352 - BORDER;
+ imgY = y * IMG_HEIGHT / 288 - 3 * BORDER - 288;
+ }
+
+ int i=0;
+
+ cout << "Point ajoute: " << imgX << ", " << imgY << endl;
+ if (imgX >= 0)
+ {
// Ajout de point
if (button == GLUT_LEFT_BUTTON)
{
@@ -255,10 +283,10 @@ MouseFunc(int button, int state, int x, int y)
{
if (point[i][0] < 0)
{
- point[i][0] = x;
- point[i][1] = y;
+ point[i][0] = imgX;
+ point[i][1] = imgY;
i=5;
- cout << "Point ajoute: " << x << ", " << y << endl;
+ cout << "Point ajoute: " << imgX << ", " << imgY << endl;
}
i++;
}
@@ -270,7 +298,7 @@ MouseFunc(int button, int state, int x, int y)
{
while(i<3)
{
- if ((abs(point[i][0] - x) < 5) && (abs(point[i][1] -y) < 5))
+ if ((abs(point[i][0] - imgX) < 5) && (abs(point[i][1] - imgY) < 5))
{
point[i][0] = -1;
point[i][1] = -1;
@@ -282,7 +310,6 @@ MouseFunc(int button, int state, int x, int y)
}
}
DrawGLScene();
-
}
}
@@ -303,7 +330,7 @@ main(int argc, char **argv)
InitGL(WIDTH, HEIGHT);
// Init de comm
- comm = new Comm("im.jpg");
+ comm = new Comm("test.rgb");
//Initialisation des signal handlers
signal(SIGUSR1, ExecuteUiCmds);