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
..
2015-01-04 17:43:57 +11:00
2014-05-04 15:39:15 -07:00
2014-05-04 15:39:15 -07:00
2014-05-07 20:32:50 -07:00
2015-01-21 11:57:11 +11:00
2014-05-30 08:22:44 +09:00
2013-08-18 14:15:51 +00:00
2013-07-02 09:47:22 +00:00
2014-03-19 23:57:49 -07:00
2014-10-07 15:47:32 -05:00
2013-05-28 01:15:59 +00:00
2014-10-07 15:47:32 -05:00
2012-10-09 13:36:42 +00:00
2014-10-07 15:47:32 -05:00
2013-03-18 11:44:56 +00:00
2012-10-09 13:36:42 +00:00
2014-10-07 15:47:32 -05:00
2013-11-04 19:21:32 +00:00
2014-11-21 14:16:35 +01:00
2013-08-07 05:24:47 +00:00
2013-03-23 03:04:02 +00:00
2012-10-09 13:36:42 +00:00
2011-10-23 17:52:20 +00:00
2012-10-09 13:36:42 +00:00
2013-11-04 19:22:47 +00:00
2013-01-30 05:55:17 +00:00
2012-10-09 13:36:42 +00:00
2014-04-30 18:53:32 -07:00
2012-10-09 13:36:42 +00:00
2014-07-17 22:52:23 -07:00
2014-07-17 22:52:23 -07:00
2015-01-07 20:38:05 -08:00
2014-10-07 15:47:32 -05:00
2011-10-23 17:52:20 +00:00
2012-10-09 13:36:42 +00:00
2014-04-30 11:57:12 +03:00
2014-04-30 11:57:12 +03:00
2011-10-23 17:52:20 +00:00
2012-07-18 23:03:27 +00:00
2015-01-15 18:37:22 +01:00
2015-01-15 18:37:22 +01:00
2012-09-16 04:58:18 +00:00
2013-11-04 19:22:47 +00:00
2012-10-09 13:36:42 +00:00
2012-10-22 08:15:51 +00:00
2012-10-09 13:36:42 +00:00
2013-02-26 23:08:42 +00:00
2013-02-26 21:58:06 +00:00
2012-10-29 02:11:40 +00:00
2012-09-16 04:58:18 +00:00
2013-11-04 19:21:07 +00:00
2012-06-25 09:14:37 +00:00
2015-01-07 20:38:05 -08:00
2015-01-07 20:38:05 -08:00
2014-08-23 20:24:19 +02:00
2014-03-27 22:32:06 -07:00
2014-03-27 22:32:06 -07:00
2014-04-12 20:12:07 +02:00
2013-07-02 09:47:22 +00:00
2012-10-09 13:36:42 +00:00
2014-04-23 19:39:57 -07:00
2013-03-29 06:21:28 +00:00
2013-11-04 19:22:47 +00:00
2013-11-04 19:22:47 +00:00
2015-01-05 22:07:35 -08:00
2014-06-25 15:47:37 -07:00
2014-11-21 14:16:35 +01:00
2014-07-21 10:53:07 +10:00
2014-08-10 00:40:15 +02:00
2012-10-09 13:36:42 +00:00
2014-02-22 13:57:12 +11:00
2012-10-09 13:36:42 +00:00
2013-02-23 01:17:01 +00:00
2012-10-09 13:36:42 +00:00
2014-06-17 22:00:13 +10:00
2013-01-30 05:55:17 +00:00
2013-08-04 17:20:03 +00:00
2012-09-16 04:58:18 +00:00
2012-02-25 16:49:59 +00:00
2012-06-25 09:14:37 +00:00
2012-09-16 04:58:18 +00:00
2012-10-09 13:36:42 +00:00
2012-10-09 13:36:42 +00:00
2013-11-04 19:22:10 +00:00
2013-08-03 23:58:17 +00:00
2012-02-25 16:49:59 +00:00
2012-06-25 09:14:37 +00:00
2014-07-29 00:22:13 -03:00
2012-10-09 13:36:42 +00:00
2015-01-04 17:43:57 +11:00
2012-10-09 13:36:42 +00:00
2015-01-22 03:00:24 -02:00
2013-12-24 05:44:54 +11:00
2014-06-25 15:47:37 -07:00
2012-09-16 04:58:18 +00:00
2012-10-23 11:47:23 +00:00
2013-11-18 18:13:23 +06:00
2013-11-17 15:09:57 +11:00
2012-10-09 13:36:42 +00:00
2013-11-04 19:22:47 +00:00
2012-10-09 13:36:42 +00:00
2013-11-04 19:22:47 +00:00
2013-11-04 19:22:47 +00:00
2011-10-23 17:52:20 +00:00
2012-10-09 13:36:42 +00:00
2014-04-30 18:53:32 -07:00
2014-06-17 22:13:44 +10:00
2013-11-04 19:22:47 +00:00
2012-10-21 05:46:41 +00:00
2013-11-04 19:22:47 +00:00
2013-11-04 19:22:47 +00:00
2012-11-10 05:42:50 +00:00
2012-08-18 13:07:48 +00:00
2012-09-16 04:58:18 +00:00
2012-10-09 13:36:42 +00:00
2012-02-25 16:49:59 +00:00
2012-06-25 09:14:37 +00:00
2012-02-25 16:49:59 +00:00
2012-06-25 09:14:37 +00:00
2015-01-07 20:41:07 -08:00
2015-01-07 20:38:05 -08:00
2013-03-26 07:29:01 +00:00
2012-10-09 13:36:42 +00:00
2012-09-16 04:58:18 +00:00
2012-09-16 04:58:18 +00:00
2012-09-16 04:58:18 +00:00
2012-09-16 04:58:18 +00:00
2013-11-24 15:23:38 +11:00
2012-11-05 14:24:35 +00:00
2011-10-23 17:52:20 +00:00
2012-02-23 10:41:31 +00:00
2014-08-09 17:19:13 +02:00
2012-10-09 13:36:42 +00:00
2012-04-11 08:15:13 +00:00
2012-10-15 02:15:07 +00:00
2012-04-11 08:15:13 +00:00
2012-10-15 02:15:07 +00:00
2014-06-17 22:04:40 +10:00
2014-05-01 19:43:07 -07:00
2014-04-30 18:53:32 -07:00
2014-01-24 02:10:45 -02:00
2014-07-14 18:30:27 -07:00
2014-07-14 18:30:27 -07:00
2013-07-02 09:47:22 +00:00
2013-02-21 18:30:11 +00:00
2013-04-10 22:49:50 +00:00
2012-12-18 20:56:25 +00:00
2011-10-23 17:52:20 +00:00
2012-02-23 10:41:31 +00:00
2011-10-23 17:52:20 +00:00
2013-12-24 05:44:54 +11:00
2011-10-23 17:52:20 +00:00
2012-10-09 13:36:42 +00:00
2014-10-07 15:47:32 -05:00