Page 1 of 1

setTransform not working

Posted: Fri Apr 04, 2008 4:00 pm
by andytheb
Hi,

I'm trying to get setTransform to work for headtracking. But while the generated projection matrix changes a desired, there is no change in the graphical output.

Code: Select all

    float nearPlane = 0.05;
    matrix4 projectionMatrix = make_projection_matrix( nearPlane*( -0.5 * aspectRatio + headPosition.X)/ d,
						       nearPlane*(  0.5 * aspectRatio + headPosition.X)/ d,
						       nearPlane*( -0.5 - headPosition.Y ) / d,
						       nearPlane*(  0.5 - headPosition.Y ) / d,
						       nearPlane, 100);
    
    driver->setTransform(ETS_PROJECTION, projectionMatrix);
    
    smgr->drawAll();
       
    driver->endScene();
Is there anything I've missed?

I'm using opengl on linux x64.

Andy

Posted: Fri Apr 04, 2008 4:16 pm
by vitek
The camera will, as part of smgr->drawAll(), reset the projection matrix. Even if you aren't using a camera, then the scene manager still resets the projection to the identity matrix. If you want to set the projection matrix, you should set the projection on the camera directly.

Out of curiousity, what device are you using for head tracking?

Travis

Posted: Fri Apr 04, 2008 5:25 pm
by andytheb
Ah, ok, the projection is being applied now.

I'm using a webcam (with sunglasses as filter) that tracks two bright red leds that are attached to some glasses.
This works ok, at least in a dark room.
You don't really need irleds, because the cmos sensor is sensitive enough in that part of the spectrum.

I'll release the source, as soon as I get the projection right...

Andy

Posted: Sun Apr 06, 2008 7:04 am
by andytheb