Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - monkokio

Pages: [1]
1
Support / Re: 2cameras at once/stereoscopic 3d?
« on: August 23, 2011, 07:50:37 am »
Absolutely perfect!
Thank you so much, EgonOlsen! You have been a tremendous help!

To sum everything up:
Code: [Select]

// create the FrameBuffer at half the width of the actual window
mFrameBuffer = new FrameBuffer(gl, w/2, h);

// compute your FOV values (using the aspect ratio of the actual window)
float xFOV = SOME_CHOSEN_VALUE;
float yFOV = 2.0f * Math.atan( Math.tan(xFOV * 0.5f) * h/w );

// tell the camera to render at the aspect ratio of the actual window, not the aspect ratio of the frame buffer
com.threed.jpct.Config.autoMaintainAspectRatio = false;
Camera cam = world.getCamera();
cam.setFOVLimits(LOWER_LIMIT, HIGHER_LIMIT); // I wanted a narrow FOV, so I found that I needed to change my FOV limits
cam.setFOV( (float) Math.atan( xFOV  ) );
cam.setYFOV( (float) Math.atan( yFOV  ) );


// ... when it comes time to render ...

cam.setPosition( LEFT_EYE_POSITION );
cam.lookAt( TARGET_POSITION );
com.threed.jpct.Config.viewportOffsetX = 0.0f;
world.renderScene(fb);
world.draw(fb);

cam.setPosition(RIGHT_EYE_POSITION );
cam.lookAt( TARGET_POSITION );
com.threed.jpct.Config.viewportOffsetX = 1.0f;
world.renderScene(fb);
world.draw(fb);

fb.display();



2
Support / Re: 2cameras at once/stereoscopic 3d?
« on: August 22, 2011, 07:26:12 pm »
Thanks for the tip, I have been digging around and it seems like this flag is used primarily to avoid changing the aspect ratio when drawing to a render target that has a different aspect ratio. I don't see a way to explicitly set the aspect ratio when the autoMaintainAspectRatio flag is false.
If I am able to set the aspect ratio directly, I think that will be exactly enough to get this working correctly.

When I get back to my workstation tonight, I will poke around and post a follow-up with my progress.

3
Support / Re: 2cameras at once/stereoscopic 3d?
« on: August 22, 2011, 08:41:48 am »
I am trying to work with the LG Real3D API that just came out. It is asking for the image to be displayed in the same way.

I am super close, I can get two images rendered correctly by creating the frame buffer with half the width and then setting Config.viewportOffsetX between each render.

The one problem is that the render uses the aspect ratio of half of the screen (what I set the frame buffer to) - when I want it to use the aspect ratio of the entire screen. The LG API interleaves the pixel columns of two renders, which spaces out the images and makes them appear to be at the aspect ratio of the whole screen.

Any ideas on how to get this last part working?

Pages: [1]