blender/source/gameengine/Ketsji
Dalai Felinto 8ed439b89e bge.render.getStereoEye() and bge.types.LEFT_EYE/RIGHT_EYE
This function allows the user to run specific code for each of the
rendered stereoscopic eyes in the Game Engine.

The initial use case is to set the camera projection matrix in
a scene.pre_draw callback function for each eye, to be used in VR
(Virtual Reality) installations.

Reviewed by Mitchell Stokes and Campbell Barton, thank you guys.

Sample Test Python Script:
"""
import bge
import bgl
import blf

def init():
    """init function - runs once"""
    scene = bge.logic.getCurrentScene()
    scene.post_draw.append(write)

def write():
    """write on screen - depending on the eye"""
    width = bge.render.getWindowWidth()
    height = bge.render.getWindowHeight()

    # OpenGL setup
    bgl.glMatrixMode(bgl.GL_PROJECTION)
    bgl.glLoadIdentity()
    bgl.gluOrtho2D(0, width, 0, height)
    bgl.glMatrixMode(bgl.GL_MODELVIEW)
    bgl.glLoadIdentity()

    eye = bge.render.getStereoEye()

    if eye == bge.render.LEFT_EYE:
        blf.position(0, (width * 0.2), (height * 0.3), 0)
        blf.size(0, 40, 72)
        blf.draw(0, "Left")

    else: # bge.render.RIGHT_EYE:
        blf.position(0, (width * 0.7), (height * 0.3), 0)
        blf.size(0, 40, 72)
        blf.draw(0, "Right")
"""
2015-01-22 03:00:24 -02:00
..
KXNetwork mathutils: refactor instantiation 2015-01-04 17:43:57 +11:00
BL_Action.cpp Fix T39928: Blender crash/freeze when game engine is started with animation played directly on camera object with parents. 2014-05-04 15:39:15 -07:00
BL_Action.h Fix T39928: Blender crash/freeze when game engine is started with animation played directly on camera object with parents. 2014-05-04 15:39:15 -07:00
BL_ActionManager.cpp BGE: Dynamically-allocated action layers 2014-05-07 20:32:50 -07:00
BL_ActionManager.h Cleanup: style 2015-01-21 11:57:11 +11:00
BL_BlenderShader.cpp Followup to rB1973b17fce65, partially bring back GLSL lamp's previous behavior. 2014-05-30 08:22:44 +09:00
BL_BlenderShader.h Fix a few compiler warnings reported by clang. 2013-08-18 14:15:51 +00:00
BL_Material.cpp add missing gpl headers 2013-07-02 09:47:22 +00:00
BL_Material.h BGE: Adding support for the Cast Only material option. 2014-03-19 23:57:49 -07:00
BL_Shader.cpp Ghost Context Refactor 2014-10-07 15:47:32 -05:00
BL_Shader.h code cleanup: comment/remove unused defines 2013-05-28 01:15:59 +00:00
BL_Texture.cpp Ghost Context Refactor 2014-10-07 15:47:32 -05:00
BL_Texture.h code cleanup: make header defines more consistent, JOYSENSOR header guard had a typo too. 2012-10-09 13:36:42 +00:00
CMakeLists.txt Ghost Context Refactor 2014-10-07 15:47:32 -05:00
KX_ArmatureSensor.cpp style cleanup 2013-03-18 11:44:56 +00:00
KX_ArmatureSensor.h code cleanup: make header defines more consistent, JOYSENSOR header guard had a typo too. 2012-10-09 13:36:42 +00:00
KX_BlenderMaterial.cpp Ghost Context Refactor 2014-10-07 15:47:32 -05:00
KX_BlenderMaterial.h BGE Rasterizer Cleanup: Removing the need to reference KX_BlenderMaterial or KX_PolygonMaterial in RAS_OpenGLRasterizer. 2013-11-04 19:21:32 +00:00
KX_Camera.cpp Cleanup: typo 2014-11-21 14:16:35 +01:00
KX_Camera.h Adding a fov attribute to KX_Camera. This attribute converts the field of view value and uses it to set lens. 2013-08-07 05:24:47 +00:00
KX_CameraActuator.cpp BGE: getting rid of a few maybe-uninitialized warnings. 2013-03-23 03:04:02 +00:00
KX_CameraActuator.h code cleanup: make header defines more consistent, JOYSENSOR header guard had a typo too. 2012-10-09 13:36:42 +00:00
KX_CameraIpoSGController.cpp remove $Id: tags after discussion on the mailign list: http://markmail.org/message/fp7ozcywxum3ar7n 2011-10-23 17:52:20 +00:00
KX_CameraIpoSGController.h code cleanup: make header defines more consistent, JOYSENSOR header guard had a typo too. 2012-10-09 13:36:42 +00:00
KX_CharacterWrapper.cpp BGE: Cleaning up the BGE's physics code and removing KX_IPhysicsController and KX_BulletPhysicsController. Instead, we just use PHY_IPhysicsController, which removes a lot of duplicate code. 2013-11-04 19:22:47 +00:00
KX_CharacterWrapper.h BGE: Some various changes to make moving the character physics type easier: 2013-01-30 05:55:17 +00:00
KX_ClientObjectInfo.h code cleanup: make header defines more consistent, JOYSENSOR header guard had a typo too. 2012-10-09 13:36:42 +00:00
KX_ConstraintActuator.cpp BGE cleanup: KX_GameObject::GetParent() no longer increases the object's refcount. 2014-04-30 18:53:32 -07:00
KX_ConstraintActuator.h code cleanup: make header defines more consistent, JOYSENSOR header guard had a typo too. 2012-10-09 13:36:42 +00:00
KX_ConstraintWrapper.cpp BGE: Add missing documentation and attribute constraint_type for ConstraintWrapper 2014-07-17 22:52:23 -07:00
KX_ConstraintWrapper.h BGE: Add missing documentation and attribute constraint_type for ConstraintWrapper 2014-07-17 22:52:23 -07:00
KX_Dome.cpp Revert "Fix T40257: Frustum culling not working properly" 2015-01-07 20:38:05 -08:00
KX_Dome.h Ghost Context Refactor 2014-10-07 15:47:32 -05:00
KX_EmptyObject.cpp remove $Id: tags after discussion on the mailign list: http://markmail.org/message/fp7ozcywxum3ar7n 2011-10-23 17:52:20 +00:00
KX_EmptyObject.h code cleanup: make header defines more consistent, JOYSENSOR header guard had a typo too. 2012-10-09 13:36:42 +00:00
KX_FontObject.cpp Change naming slightly, it conflicts with DrawText function define on 2014-04-30 11:57:12 +03:00
KX_FontObject.h Change naming slightly, it conflicts with DrawText function define on 2014-04-30 11:57:12 +03:00
KX_GameActuator.cpp remove $Id: tags after discussion on the mailign list: http://markmail.org/message/fp7ozcywxum3ar7n 2011-10-23 17:52:20 +00:00
KX_GameActuator.h quiet double promotion warnings for the game engine. 2012-07-18 23:03:27 +00:00
KX_GameObject.cpp BGE physics: get/set linear and angular damping 2015-01-15 18:37:22 +01:00
KX_GameObject.h BGE physics: get/set linear and angular damping 2015-01-15 18:37:22 +01:00
KX_IInterpolator.h style cleanup 2012-09-16 04:58:18 +00:00
KX_IPO_SGController.cpp BGE: Cleaning up the BGE's physics code and removing KX_IPhysicsController and KX_BulletPhysicsController. Instead, we just use PHY_IPhysicsController, which removes a lot of duplicate code. 2013-11-04 19:22:47 +00:00
KX_IPO_SGController.h code cleanup: make header defines more consistent, JOYSENSOR header guard had a typo too. 2012-10-09 13:36:42 +00:00
KX_IpoActuator.cpp style cleanup 2012-10-22 08:15:51 +00:00
KX_IpoActuator.h code cleanup: make header defines more consistent, JOYSENSOR header guard had a typo too. 2012-10-09 13:36:42 +00:00
KX_IpoConvert.cpp add PHY headers to cmake's ketsji (else some IDE's won't show) 2013-02-26 23:08:42 +00:00
KX_IpoConvert.h Fix various warnings with clang build, and adjust cmake clang warnings flags 2013-02-26 21:58:06 +00:00
KX_IPOTransform.h style cleanup 2012-10-29 02:11:40 +00:00
KX_IScalarInterpolator.h style cleanup 2012-09-16 04:58:18 +00:00
KX_ISceneConverter.h BGE Rasterizer Cleanup: Removing RAS_IRenderTools and moving the functionality to RAS_IRasterizer. RAS_OpenGLRasterizer is a bit of a mess now with references to Ketsji and other modules it shouldn't be accessing. 2013-11-04 19:21:07 +00:00
KX_ISystem.h optionally use guarded alloc for tiles compositor, also replace allocation functions with a macro. 2012-06-25 09:14:37 +00:00
KX_KetsjiEngine.cpp Revert "Fix T40257: Frustum culling not working properly" 2015-01-07 20:38:05 -08:00
KX_KetsjiEngine.h Revert "Fix T40257: Frustum culling not working properly" 2015-01-07 20:38:05 -08:00
KX_Light.cpp gameengine: fix T41272 - KX_Light.color returns wrong values 2014-08-23 20:24:19 +02:00
KX_Light.h BGE code cleanup: Removing OpenGL and bf_gpu code from KX_LightObject 2014-03-27 22:32:06 -07:00
KX_LightIpoSGController.cpp BGE code cleanup: Removing OpenGL and bf_gpu code from KX_LightObject 2014-03-27 22:32:06 -07:00
KX_LightIpoSGController.h Code cleanup: RAS_ILightObject is class, not a struct. 2014-04-12 20:12:07 +02:00
KX_MaterialIpoController.cpp add missing gpl headers 2013-07-02 09:47:22 +00:00
KX_MaterialIpoController.h code cleanup: make header defines more consistent, JOYSENSOR header guard had a typo too. 2012-10-09 13:36:42 +00:00
KX_MeshProxy.cpp BGE Cleanup: Moving reinstancing physics shapes from KX_ConvertPhysicsObject to PHY_IPhysicsController 2014-04-23 19:39:57 -07:00
KX_MeshProxy.h style cleanup 2013-03-29 06:21:28 +00:00
KX_MotionState.cpp BGE: Cleaning up the BGE's physics code and removing KX_IPhysicsController and KX_BulletPhysicsController. Instead, we just use PHY_IPhysicsController, which removes a lot of duplicate code. 2013-11-04 19:22:47 +00:00
KX_MotionState.h BGE: Cleaning up the BGE's physics code and removing KX_IPhysicsController and KX_BulletPhysicsController. Instead, we just use PHY_IPhysicsController, which removes a lot of duplicate code. 2013-11-04 19:22:47 +00:00
KX_MouseActuator.cpp BGE: Fix for bugs T42520 and T42097 (mouse look actuator related). 2015-01-05 22:07:35 -08:00
KX_MouseActuator.h BGE: New Mouse Actuator 2014-06-25 15:47:37 -07:00
KX_MouseFocusSensor.cpp Cleanup: typo 2014-11-21 14:16:35 +01:00
KX_MouseFocusSensor.h Cleanup 2014-07-21 10:53:07 +10:00
KX_NavMeshObject.cpp BGE: fix a bug causing frequent crash on scene restart with navmesh. 2014-08-10 00:40:15 +02:00
KX_NavMeshObject.h code cleanup: make header defines more consistent, JOYSENSOR header guard had a typo too. 2012-10-09 13:36:42 +00:00
KX_NearSensor.cpp Fix T38539: Can't set near sensor distance above 100 via python 2014-02-22 13:57:12 +11:00
KX_NearSensor.h code cleanup: make header defines more consistent, JOYSENSOR header guard had a typo too. 2012-10-09 13:36:42 +00:00
KX_ObColorIpoSGController.cpp BGE: Object color channels can now be animated separately without zeroing out the other channels. Problem reported by Dalai via IRC. 2013-02-23 01:17:01 +00:00
KX_ObColorIpoSGController.h code cleanup: make header defines more consistent, JOYSENSOR header guard had a typo too. 2012-10-09 13:36:42 +00:00
KX_ObjectActuator.cpp Support for building without Python 2014-06-17 22:00:13 +10:00
KX_ObjectActuator.h BGE: Some various changes to make moving the character physics type easier: 2013-01-30 05:55:17 +00:00
KX_ObstacleSimulation.cpp fix memory leak in KX_ObstacleSimulation 2013-08-04 17:20:03 +00:00
KX_ObstacleSimulation.h style cleanup 2012-09-16 04:58:18 +00:00
KX_OrientationInterpolator.cpp style cleanup, use { on newline after function definition. 2012-02-25 16:49:59 +00:00
KX_OrientationInterpolator.h optionally use guarded alloc for tiles compositor, also replace allocation functions with a macro. 2012-06-25 09:14:37 +00:00
KX_ParentActuator.cpp style cleanup 2012-09-16 04:58:18 +00:00
KX_ParentActuator.h code cleanup: make header defines more consistent, JOYSENSOR header guard had a typo too. 2012-10-09 13:36:42 +00:00
KX_PhysicsEngineEnums.h code cleanup: make header defines more consistent, JOYSENSOR header guard had a typo too. 2012-10-09 13:36:42 +00:00
KX_PolyProxy.cpp BGE Rasterizer Cleanup: Cleaning up some includes. 2013-11-04 19:22:10 +00:00
KX_PolyProxy.h code cleanup: remove unused define, correct header guard mismatch, add NULL check so DM_to_mesh() can have a NULL object passed (currently not used) and remove redundant NULL check. 2013-08-03 23:58:17 +00:00
KX_PositionInterpolator.cpp style cleanup, use { on newline after function definition. 2012-02-25 16:49:59 +00:00
KX_PositionInterpolator.h optionally use guarded alloc for tiles compositor, also replace allocation functions with a macro. 2012-06-25 09:14:37 +00:00
KX_PyConstraintBinding.cpp BGE: Constraint wrapper fix. 2014-07-29 00:22:13 -03:00
KX_PyConstraintBinding.h code cleanup: make header defines more consistent, JOYSENSOR header guard had a typo too. 2012-10-09 13:36:42 +00:00
KX_PyMath.cpp mathutils: refactor instantiation 2015-01-04 17:43:57 +11:00
KX_PyMath.h code cleanup: make header defines more consistent, JOYSENSOR header guard had a typo too. 2012-10-09 13:36:42 +00:00
KX_PythonInit.cpp bge.render.getStereoEye() and bge.types.LEFT_EYE/RIGHT_EYE 2015-01-22 03:00:24 -02:00
KX_PythonInit.h Style cleanup: BGE 2013-12-24 05:44:54 +11:00
KX_PythonInitTypes.cpp BGE: New Mouse Actuator 2014-06-25 15:47:37 -07:00
KX_PythonInitTypes.h style cleanup 2012-09-16 04:58:18 +00:00
KX_PythonMain.cpp code cleanup: remove $Id's that crept back in, also osl style edits 2012-10-23 11:47:23 +00:00
KX_PythonMain.h Fix T37488: Crash with --debug reading userpref.blend 2013-11-18 18:13:23 +06:00
KX_PythonSeq.cpp python api internals: no need to set the stop-iter exception string. 2013-11-17 15:09:57 +11:00
KX_PythonSeq.h code cleanup: make header defines more consistent, JOYSENSOR header guard had a typo too. 2012-10-09 13:36:42 +00:00
KX_RadarSensor.cpp BGE: Cleaning up the BGE's physics code and removing KX_IPhysicsController and KX_BulletPhysicsController. Instead, we just use PHY_IPhysicsController, which removes a lot of duplicate code. 2013-11-04 19:22:47 +00:00
KX_RadarSensor.h code cleanup: make header defines more consistent, JOYSENSOR header guard had a typo too. 2012-10-09 13:36:42 +00:00
KX_RayCast.cpp BGE: Cleaning up the BGE's physics code and removing KX_IPhysicsController and KX_BulletPhysicsController. Instead, we just use PHY_IPhysicsController, which removes a lot of duplicate code. 2013-11-04 19:22:47 +00:00
KX_RayCast.h BGE: Cleaning up the BGE's physics code and removing KX_IPhysicsController and KX_BulletPhysicsController. Instead, we just use PHY_IPhysicsController, which removes a lot of duplicate code. 2013-11-04 19:22:47 +00:00
KX_RayEventManager.cpp remove $Id: tags after discussion on the mailign list: http://markmail.org/message/fp7ozcywxum3ar7n 2011-10-23 17:52:20 +00:00
KX_RayEventManager.h code cleanup: make header defines more consistent, JOYSENSOR header guard had a typo too. 2012-10-09 13:36:42 +00:00
KX_RaySensor.cpp BGE cleanup: KX_GameObject::GetParent() no longer increases the object's refcount. 2014-04-30 18:53:32 -07:00
KX_RaySensor.h Fix T40620: BGE Python - Ray sensor has wrong axis constants 2014-06-17 22:13:44 +10:00
KX_SCA_AddObjectActuator.cpp BGE: Cleaning up the BGE's physics code and removing KX_IPhysicsController and KX_BulletPhysicsController. Instead, we just use PHY_IPhysicsController, which removes a lot of duplicate code. 2013-11-04 19:22:47 +00:00
KX_SCA_AddObjectActuator.h style cleanup: trailing tabs & expand some non prefix tabs into spaces. 2012-10-21 05:46:41 +00:00
KX_SCA_DynamicActuator.cpp BGE: Cleaning up the BGE's physics code and removing KX_IPhysicsController and KX_BulletPhysicsController. Instead, we just use PHY_IPhysicsController, which removes a lot of duplicate code. 2013-11-04 19:22:47 +00:00
KX_SCA_DynamicActuator.h BGE: Cleaning up the BGE's physics code and removing KX_IPhysicsController and KX_BulletPhysicsController. Instead, we just use PHY_IPhysicsController, which removes a lot of duplicate code. 2013-11-04 19:22:47 +00:00
KX_SCA_EndObjectActuator.cpp code cleanup: some warnings and formatting for PyMethodDef's in the BGE. 2012-11-10 05:42:50 +00:00
KX_SCA_EndObjectActuator.h style cleanup: also correct some doxy comments 2012-08-18 13:07:48 +00:00
KX_SCA_ReplaceMeshActuator.cpp style cleanup 2012-09-16 04:58:18 +00:00
KX_SCA_ReplaceMeshActuator.h code cleanup: make header defines more consistent, JOYSENSOR header guard had a typo too. 2012-10-09 13:36:42 +00:00
KX_ScalarInterpolator.cpp style cleanup, use { on newline after function definition. 2012-02-25 16:49:59 +00:00
KX_ScalarInterpolator.h optionally use guarded alloc for tiles compositor, also replace allocation functions with a macro. 2012-06-25 09:14:37 +00:00
KX_ScalingInterpolator.cpp style cleanup, use { on newline after function definition. 2012-02-25 16:49:59 +00:00
KX_ScalingInterpolator.h optionally use guarded alloc for tiles compositor, also replace allocation functions with a macro. 2012-06-25 09:14:37 +00:00
KX_Scene.cpp Fix T40257: Frustum culling not working properly 2015-01-07 20:41:07 -08:00
KX_Scene.h Revert "Fix T40257: Frustum culling not working properly" 2015-01-07 20:38:05 -08:00
KX_SceneActuator.cpp style cleanup: 2013-03-26 07:29:01 +00:00
KX_SceneActuator.h code cleanup: make header defines more consistent, JOYSENSOR header guard had a typo too. 2012-10-09 13:36:42 +00:00
KX_SG_BoneParentNodeRelationship.cpp style cleanup 2012-09-16 04:58:18 +00:00
KX_SG_BoneParentNodeRelationship.h style cleanup 2012-09-16 04:58:18 +00:00
KX_SG_NodeRelationships.cpp style cleanup 2012-09-16 04:58:18 +00:00
KX_SG_NodeRelationships.h style cleanup 2012-09-16 04:58:18 +00:00
KX_SoundActuator.cpp Code Cleanup: whitespace / formatting 2013-11-24 15:23:38 +11:00
KX_SoundActuator.h Audaspace: 2012-11-05 14:24:35 +00:00
KX_StateActuator.cpp remove $Id: tags after discussion on the mailign list: http://markmail.org/message/fp7ozcywxum3ar7n 2011-10-23 17:52:20 +00:00
KX_StateActuator.h use __ prefix on header guards to avoid mixing up defines with api functions / classes. 2012-02-23 10:41:31 +00:00
KX_SteeringActuator.cpp BGE: Fix bug with Steering Actuator Python API. 2014-08-09 17:19:13 +02:00
KX_SteeringActuator.h code cleanup: make header defines more consistent, JOYSENSOR header guard had a typo too. 2012-10-09 13:36:42 +00:00
KX_TimeCategoryLogger.cpp code cleanup: float formatting was confusing in some cases - eg: (0.,0.,0.) 2012-04-11 08:15:13 +00:00
KX_TimeCategoryLogger.h code cleanup: check for msvc directly when using warning pragma's. 2012-10-15 02:15:07 +00:00
KX_TimeLogger.cpp code cleanup: float formatting was confusing in some cases - eg: (0.,0.,0.) 2012-04-11 08:15:13 +00:00
KX_TimeLogger.h code cleanup: check for msvc directly when using warning pragma's. 2012-10-15 02:15:07 +00:00
KX_TouchEventManager.cpp Fix for bad NULL check 2014-06-17 22:04:40 +10:00
KX_TouchEventManager.h BGE cleanup: Removing the unused SCA_EventManager::Replace_PhysicsScene(). 2014-05-01 19:43:07 -07:00
KX_TouchSensor.cpp BGE cleanup: KX_GameObject::GetParent() no longer increases the object's refcount. 2014-04-30 18:53:32 -07:00
KX_TouchSensor.h game engine: implement hitMaterial for collision and ray sensors 2014-01-24 02:10:45 -02:00
KX_TrackToActuator.cpp BGE: TrackTo actuator: increasing up & track axis options 2014-07-14 18:30:27 -07:00
KX_TrackToActuator.h BGE: TrackTo actuator: increasing up & track axis options 2014-07-14 18:30:27 -07:00
KX_VehicleWrapper.cpp add missing gpl headers 2013-07-02 09:47:22 +00:00
KX_VehicleWrapper.h BGE cleanup: Removing the PHY__Vector classes and replacing them with MT_Vectors. The PHY__Vectors didn't offer anything (not even any real abstraction) and they required annoying MT_Vector <-> PHY_Vector conversions all over the place. No functional changes. 2013-02-21 18:30:11 +00:00
KX_VertexProxy.cpp code cleanup: unused vars, make other vars static. 2013-04-10 22:49:50 +00:00
KX_VertexProxy.h BGE: Some as of yet unmerged work I did in the Swiss branch. These changes include: 2012-12-18 20:56:25 +00:00
KX_VisibilityActuator.cpp remove $Id: tags after discussion on the mailign list: http://markmail.org/message/fp7ozcywxum3ar7n 2011-10-23 17:52:20 +00:00
KX_VisibilityActuator.h use __ prefix on header guards to avoid mixing up defines with api functions / classes. 2012-02-23 10:41:31 +00:00
KX_WorldInfo.cpp remove $Id: tags after discussion on the mailign list: http://markmail.org/message/fp7ozcywxum3ar7n 2011-10-23 17:52:20 +00:00
KX_WorldInfo.h Style cleanup: BGE 2013-12-24 05:44:54 +11:00
KX_WorldIpoController.cpp remove $Id: tags after discussion on the mailign list: http://markmail.org/message/fp7ozcywxum3ar7n 2011-10-23 17:52:20 +00:00
KX_WorldIpoController.h code cleanup: make header defines more consistent, JOYSENSOR header guard had a typo too. 2012-10-09 13:36:42 +00:00
SConscript Ghost Context Refactor 2014-10-07 15:47:32 -05:00