Se cerchi le coordinate esatte puoi fare (piu' o meno) cosi:
GLfloat pixel;
float dx,dy,dz;
glReadPixels( mid.x(),mid.y(), 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, (void
*) &pixel);
// e poi:
gluUnProject ((double) mid.x(), mid.y(), pixel, mvmatrix, projmatrix,
viewport, &dx, &dy, &dz);
// ti da le coordinate originali: (dx,dy,dz)
http://www.ncrg.aston.ac.uk/~cornfosd/graphics/opengl/openglman.html
Se invece cerchi un FacePointer vicino al mouse: (/wrap/gl/pick.h)
vector<CMeshO::FacePointer> NewSel;
GLPickTri<CMeshO>::PickFace(mid.x(), mid.y(), m.cm, NewSel, wid.x(),
wid.y());
Luca Colombini wrote:
> Nel caso il click del mouse avvenga sopra una mesh, mi serve sapere le
> coordinate del punto in cui mi trovo, quindi mi servirebbe sapere se c'è
> già una variabile o una funzione che fa al caso mio...
>
> /-------Messaggio originale-------/
>
> /*Da:*/ Gfrei Andreas <mailto:gfr...@gm...>
> /*Data:*/ 02/14/07 17:59:45
> /*A:*/ Meshlab development list <mailto:mes...@li...>
> /*Oggetto:*/ Re: [Meshlab-devel] Mouse Click
>
> Luca Colombini wrote:
>> Volevo sapere se in Meshlab o nella libreria VCG esiste una funzione per
>> sapere se il click del mouse (ed il rilascio) avviene in un punto che si
>> trova sopra una mesh oppure in un punto fuori, (vale a dire in qualsiasi
>> punto della GLArea);
>
> Se ti basta sapere se sei dentro o fuori puoi utilizzare:
>
> glReadPixels
>
> se sei su una porzione in cui e' stato disegnato qualcosa ti da un
> valore <1 mentre per lo sfondo ti da 1, l'unico problema e' che se anche
> la trackball e' gia' stata disegnata, anche li ti da un valore <1.
>
>>
>> PS: Mi scuso se la domanda può sembrare banale, ma se non esiste nessuna
>> funzione metodo vedo di definirna una all'occorrenza che possa essermi
>> utile.
>>
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> -------------------------------------------------------------------------
>> Take Surveys. Earn Cash. Influence the Future of IT
>> Join SourceForge.net's Techsay panel and you'll get the chance to
> share your
>> opinions on IT & business topics through brief surveys-and earn cash
>>
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> <http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV>
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Meshlab-devel mailing list
>> Mes...@li...
> <mailto:Mes...@li...>
>> https://lists.sourceforge.net/lists/listinfo/meshlab-devel
>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> <http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV>
> _______________________________________________
> Meshlab-devel mailing list
> Mes...@li...
> <mailto:Mes...@li...>
> https://lists.sourceforge.net/lists/listinfo/meshlab-devel
>
>
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Meshlab-devel mailing list
> Mes...@li...
> https://lists.sourceforge.net/lists/listinfo/meshlab-devel
|