@adcox wrote:
I have a few ofSpherePrimitive objects in a 3D scene with a set radius. These spheres are placemarkers, so their size isn't particularly important. How can I go about dynamically scaling the spheres so their size on screen remains approximately the same regardless of zoom level?
I've tried to get a metric describing the screen to world zoom ratio by transforming screen points into world points:
ofVec3f screenLeft(cameraViewport.x + 0.475*cameraViewport.width, cameraViewport.y + 0.5*cameraViewport.height, z); ofVec3f screenRight(screenLeft.x + 0.2*cameraViewport.width, screenLeft.y, z); ofVec3f left = activeCam->screenToWorld(screenLeft, cameraViewport); ofVec3f right = activeCam->screenToWorld(screenRight, cameraViewport); ofVec3f diff = right - left;
I set
z
to be 0.5 (halfway between the near and far clip planes), but the length of thediff
vector remains mostly constant and doesn't provide any useful information. Any thoughts?
Posts: 1
Participants: 1