<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>Message</TITLE>

<META name=GENERATOR content="MSHTML 8.00.6001.18812"></HEAD>
<BODY>
<DIV><FONT size=2 face=Arial><SPAN class=546223716-20082009>The (x,y) coordinate 
are obtained by going through the normalize openGL coordinate transformation 
chain:</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN 
class=546223716-20082009></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT size=2 face=Arial><SPAN class=546223716-20082009>world (x,y,z) -&gt; 
camera (x,y,z) -&gt; device (x,y,depth) -&gt; screen (x,y)</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN class=546223716-20082009>screen(x,y) is the 
position in pixel on the screen where the world (x,y,z) is projected. (0,0) is 
the bottom left corner of the screen, (screenx, screeny) is the top right 
corner.</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN class=546223716-20082009>The BGE implements a 
last transformation step and converts&nbsp;screen(x,y)&nbsp;to a normalized 
blender viewport coordinate&nbsp;such that&nbsp;(0.0,0.0) is the top left pixel 
of the viewport and (1.0,1.0) is the botton 
right&nbsp;pixel.</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN class=546223716-20082009>If you want to have 
pixel coordinate, you must revert this last step. Unfortunately, it looks like 
the viewport dimension is not available from the python API.</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN 
class=546223716-20082009></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT size=2 face=Arial><SPAN 
class=546223716-20082009>Benoit</SPAN></FONT></DIV>
<BLOCKQUOTE 
style="BORDER-LEFT: #0000ff 2px solid; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px">
  <DIV></DIV>
  <DIV dir=ltr lang=en-us class=OutlookMessageHeader align=left><FONT size=2 
  face=Tahoma>-----Original Message-----<BR><B>From:</B> 
  robotics-bounces@blender.org [mailto:robotics-bounces@blender.org] <B>On 
  Behalf Of </B>Hervé Legrand<BR><B>Sent:</B> jeudi 20 août 2009 
  16:58<BR><B>To:</B> robotics@blender.org<BR><B>Subject:</B> [Robotics] 
  getScreenPosition<BR><BR></FONT></DIV>Hello,<BR><BR>I wonder how the (x,y) 
  coordinates of function getScreenPosition() are obtained.<BR>What combination 
  of matrices or quaternions are used?<BR><BR>How can we pass to 3D coordinates 
  in the global scene to the 2D coordinates in the screen 
  placemark?<BR><BR>thank you for your answers.<BR></BLOCKQUOTE></BODY></HTML>