Hi,
I have problem draw a points correctly on image. I want to manualy doing 
projection of vertex and draw on image. 
I set a camera position:

Code:

osg::Matrixf l; l.makeLookAt(osg::Vec3(0, 0, 500), osg::Vec3(0,0,0), 
osg::Vec3(0,1,0));



Projection matrix:

Code:

osg::Matrixf p; p.makePerspective(osg::DegreesToRadians(50.0f), 720/568, 1, 
1000);



and next i compute new vertex cordinate (vertex is osg::Vec3):

Code:

vertex = vertex*l;



next i multiple new vertex cordinate by perspective matrix

Code:

vertex4 = osg::Vec4(vertex, 1);
vertex4 = vertex4*p;
vertex4.set(vertex4.x()/vertex4.w(), vertex4.y()/vertex4.w(), 
vertex4.z()/vertex4.w(), vertex4.w());




Now I draw vertex to image but result is diffrent with image with i get from 
3dmax with this same camera parametr.
I think I need multiple with viewport matrix 

Code:

osg::Matrixf v ;
osg::Viewport* viewport = new osg::Viewport(0,0,720,568);
v = viewport->computeWindowMatrix(); 



But when i do it vertex cordinate is too big.
Could someone tell what i doing wrong?
... 

Thank you!

Cheers,
Tomek

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=27695#27695





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to