MCPcopy Create free account
hub / github.com/cinder/Cinder / objectToWindowCoord

Function objectToWindowCoord

src/cinder/gl/wrapper.cpp:667–680  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

665}
666
667vec2 objectToWindowCoord( const mat4 &modelMatrix, const ci::vec3 &coordinate )
668{
669 // Build the viewport (x, y, width, height).
670 vec2 offset = gl::getViewport().first;
671 vec2 size = gl::getViewport().second;
672 vec4 viewport = vec4( offset.x, offset.y, size.x, size.y );
673
674 // Calculate the view-projection matrix.
675 mat4 viewProjectionMatrix = gl::getProjectionMatrix() * gl::getViewMatrix();
676
677 vec2 p = vec2( glm::project( coordinate, modelMatrix, viewProjectionMatrix, viewport ) );
678
679 return p;
680}
681
682void begin( GLenum mode )
683{

Callers

nothing calls this directly

Calls 4

getViewportFunction · 0.85
getProjectionMatrixFunction · 0.85
getViewMatrixFunction · 0.85
projectFunction · 0.85

Tested by

no test coverage detected