예제 #1
0
CameraID CameraManager::new_camera_for_viewport(const Viewport& vp) {
    float x, y, width, height;
    calculate_ratios_from_viewport(vp.type(), x, y, width, height);

    CameraID cid = new_camera();
    camera(cid)->set_perspective_projection(45.0, width / height);

    return cid;
}
예제 #2
0
파일: viewport.cpp 프로젝트: Kazade/KGLT
void Viewport::apply(const RenderTarget& target) {
    if(type_ != VIEWPORT_TYPE_CUSTOM) {
        calculate_ratios_from_viewport(type_, x_, y_, width_, height_);
    }

	GLCheck(glDisable, GL_SCISSOR_TEST);

    double x = x_ * target.width();
    double y = y_ * target.height();
    double width = width_ * target.width();
    double height = height_ * target.height();

    GLCheck(glEnable, GL_SCISSOR_TEST);
    GLCheck(glScissor, x, y, width, height);
    GLCheck(glViewport, x, y, width, height);
}