Dan,
We were able to get this working with Matrix4.computeViewportTransformation as you suggested, just passing it a viewport that is the size of the canvas. But we’re still seeing an issue with modelViewProjectionMatrix = uniformState.getModelViewProjection() when rendering CZML at the same as we’re calculating this window position. I was able to get the following code working in 3D mode, but not in 2D or Columbus:
var canvas = this.scene.getCanvas(),
camera = this.scene.getCamera(),
frustum = camera.frustum,
view = camera.getViewMatrix(),
model = Matrix4.IDENTITY,
modelView,
projection = frustum.getProjectionMatrix(),
modelViewProjectionMatrix,
viewportTransformation;
modelView = Matrix4.multiply(view, model);
modelViewProjectionMatrix = Matrix4.multiply(projection, modelView);
viewportTransformation = Matrix4.computeViewportTransformation({ x : 0,
y : 0,
width : canvas.clientWidth,
height : canvas.clientHeight });
return Transforms.pointToWindowCoordinates(modelViewProjectionMatrix, viewportTransformation, cartesian3Point);
I imagine it’s something to do with the fact that I’m passing an identity matrix for model or with how I’m grabbing the projection matrix from the camera view frustum, although, hopefully there’s an easier way to accomplish this task.
Thanks,
Jon