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.cc51
1 files changed, 48 insertions, 3 deletions
diff --git a/2004/i/nono/src/ovision/adjust.cc b/2004/i/nono/src/ovision/adjust.cc
index 6652598..682a8d9 100644
--- a/2004/i/nono/src/ovision/adjust.cc
+++ b/2004/i/nono/src/ovision/adjust.cc
@@ -14,7 +14,7 @@ using namespace std;
int window;
Comm *comm;
-
+int point[3][2] = {{-1,-1},{-1,-1},{-1,-1}};
/// Sortie du programme
void
@@ -93,7 +93,7 @@ LoadImage(int width, int height, unsigned char *data, unsigned int lastTex)
//glTexImage2D(GL_TEXTURE_2D, 0, 3, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, width, height, GL_RGB, GL_UNSIGNED_BYTE, data);
- // OConfig des parametres
+ // Config des parametres
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
@@ -187,6 +187,16 @@ DrawGLScene()
for (int i=0; i<NBIMG; i++)
DrawImage(i);
+ // Dessine points de calibration de la distance
+ for (int i=0; i<3; i++)
+ {
+ if (point[i][0] >= 0)
+ glBegin(GL_POINTS);
+ glVertex3f(point[i][0], point[i][1], -0.7f);
+ glEnd();
+ }
+
+
glFlush();
// Affiche le buffer suivant
@@ -206,6 +216,41 @@ KeyPressed(unsigned char key, int x, int y)
}
}
+/// Gestion souris
+void
+MouseFunc(int button, int state, int x, int y)
+{
+ if (state == GLUT_UP)
+ {
+ if ((x < 352+BORDER) && (y < 288+BORDER) && (x > BORDER) && (y > BORDER))
+ {
+ int i=0;
+ if (button == GLUT_LEFT_BUTTON)
+ while(i < 3)
+ {
+ if (point[i][0] < 0)
+ {
+ point[i][0] = x;
+ point[i][1] = y;
+ i=3;
+ }
+ i++;
+ }
+ else if (button == GLUT_RIGHT_BUTTON)
+ while(i<3)
+ {
+ if ((abs(point[i][0] - x) < 5) && (abs(point[i][1] -y) < 5))
+ {
+ point[i][0] = -1;
+ point[i][1] = -1;
+ i=3;
+ }
+ i++;
+ }
+ }
+ cout << "x : " << x << " " << y << endl;
+ }
+}
/// Fonction principale
int
@@ -223,7 +268,7 @@ main(int argc, char **argv)
InitGL(WIDTH, HEIGHT);
// Init de comm
- comm = new Comm("palet.jpg");
+ comm = new Comm("im.jpg");
//Initialisation des signal handlers
signal(SIGUSR1, ExecuteUiCmds);