On Thu, Nov 25, 2010 at 10:42 AM, Bobby Moore <[email protected]> wrote: > Hi, > I am really interested to use the Clutter API to design a 'true' 3D > application on an embedded platform. The application would send 2 > side-by-side packed views (left eye - right eye) to a 3D display. > > To get the 2 different views of the scene from the left and right eye, I > previously used the gluLookAt function of OpenGL, and the equivalent > matrices model in OpenGL ES 2.0. Having gone through the Clutter > documentation, I believe cogl_set_projection/modelview seems to do the > trick, providing access to the opengl matrices. > > Then I would need to get a handle on the image displayed on the screen (left > or right-eye view), the glReadPixels function and equivalent in COGL will be > too slow. Is there a way to get a handle on the buffer where everything is > rendered in Clutter ?
Hi, I think if you want to do stereo rendering we need to investigate adding support in Clutter itself. This is something I've wanted to find the time to investigate but still haven't had a chance. At the Cogl level it is possible to redirect rendering to an offscreen texture, so then your handle is a texture that you can later use to to render onscreen with. You could potentially render your left eye into one texture, then the right into another and then composite onscreen by masking out different color channels. It would probably be more efficient if we exposed an equivalent for glColorMask when rendering to a framebuffer though so you wouldn't need intermediate textures, and certainly that is something I'd like to expose at some point. see cogl_offscreen_new_to_texture and cogl_push/pop_framebuffer if you want to experiment with this approach, but you should understand that without a more integrated approach it won't really be easy to get clutter to draw a whole stage of 3d actors in stereo. it *might* be possible, but you may need some nasty hacks. As a quick aside; what you said about using gluLookAt above implies you were using the "toe in" approach. That can have parallax issues such that the straight lines of 2D content on the Z = 0 plane will no longer appear straight which may not be desirable. There are other approaches that involve setting up asymmetric frustums for each eye such that 2d content on the z=0 plane will match up exactly for each eye. You can see some discussion of that here: http://local.wasp.uwa.edu.au/~pbourke/miscellaneous/stereographics/stereorender/ If you would be interested in investigating a solution that is integrated with Clutter I would recommend look at the code in clutter-stage.c, and take a look at _clutter_stage_do_paint() as this is where rendering for the whole stage kicks off. In essence we need a way to be able to call clutter_actor_paint (CLUTTER_ACTOR (stage)); twice with a different perspective matrix for each eye, and we need some way to combine the results. (using glColorMask internally to do anaglyph style rendering would probably be an ok starting point though) I hope that helps a bit, and don't hesitate to ask if you have more questions about this stuff. thanks, - Robert _______________________________________________ clutter-app-devel-list mailing list [email protected] http://lists.clutter-project.org/listinfo/clutter-app-devel-list
