|
Top Document: SGI graphics Frequently Asked Questions (FAQ) Previous Document: -55- How can I translate screen (x,y) coords into world (x,y,z) coords? Next Document: -57- Why does nothing happen when I call mapcolor(index, R, G, B)? See reader questions & answers on this topic! - Help others by sharing your knowledge
Date: 07 May 1993 00:00:01 EST
There are two methods. The first method is detailed in
~4Dgifts/examples/grafix/world2scrn.c, which is part of the
dev.dev_sw.giftsfull package. It multiplies the (x,y,z) vector into
the current modeling and projection matrixes, and uses the result to
interpolate based on the window size and position.
The second method uses the current cursor position as a trick and is
much simpler. Use cmov() to set the cursor position to the point of
interest in world space, then call getcpos() to return the cursor
position in screen coordinates. Note that if your entire viewport is
off-screen, the results are undefined and you'll have to use the
first method.
float x,y,z;
short x1, y1;
cmov (x,y,z);
getcpos (&x1, &y1);
User Contributions:Top Document: SGI graphics Frequently Asked Questions (FAQ) Previous Document: -55- How can I translate screen (x,y) coords into world (x,y,z) coords? Next Document: -57- Why does nothing happen when I call mapcolor(index, R, G, B)? Single Page [ Usenet FAQs | Web FAQs | Documents | RFC Index ] Send corrections/additions to the FAQ Maintainer: sgi-faq@viz.tamu.edu (The SGI FAQ group)
Last Update March 27 2014 @ 02:12 PM
|

Comment about this article, ask questions, or add new information about this topic: