[Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [19887] trunk/blender/source/gameengine: BGE Rasterizer methods to handle Screen Space - (getScreenPosition, getScreenVect, getScreenRay)

Benoit Bolsee benoit.bolsee at online.be
Thu Apr 23 09:05:53 CEST 2009


I see you're using the model and projection matrix from openGL for this
calculation. 
Beware that VideoTexture can make rendering during the logic step using
a different camera than the main scene camera (for ImageRender and
ImageMirror). This may disturb these functions.
I'd suggest to use the projection matrix stored in the camera object
instead.

> 
> Log Message:
> -----------
> BGE Rasterizer methods to handle Screen Space - 
> (getScreenPosition, getScreenVect, getScreenRay)
> 
> getScreenPosition(obj):
>  - Gets the position of an object projected on screen space.
> 
> getScreenVect(x, y):
>  - Gets the vector from the camera position in the screen 
> coordinate direction.
> 
> getScreenRay(x, y, dist, property):
>  - Look towards a screen coordinate (x,y) and find first 
> object hit within dist that matches prop.
> - The ray is a call to KX_GameObject->rayCastTo from the 
> KX_Camera object.
> 
> Patch [#18589] test files can be found there. Patch reviewed 
> by Campbell
> 
[..]
> +
> +	GLdouble modelMatrix[16];
> +	GLdouble projMatrix[16];
> +	GLint	viewport[4];
> +	GLdouble win[3];
> +
> +	glGetIntegerv(GL_VIEWPORT, viewport);
> +	glGetDoublev(GL_MODELVIEW_MATRIX, modelMatrix);
> +	glGetDoublev(GL_PROJECTION_MATRIX, projMatrix);
> +



More information about the Bf-committers mailing list