本文整理汇总了C++中UserInterface::draw方法的典型用法代码示例。如果您正苦于以下问题:C++ UserInterface::draw方法的具体用法?C++ UserInterface::draw怎么用?C++ UserInterface::draw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserInterface
的用法示例。
在下文中一共展示了UserInterface::draw方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: draw
void StarsApp::draw()
{
gl::clear( Color::black() );
gl::pushMatrices();
gl::setMatrices( mCamera.getCamera() );
{
// draw background
mBackground.draw();
// draw grid
if(mIsGridVisible)
mGrid.draw();
// draw stars
mStars.draw();
}
gl::popMatrices();
// draw user interface
mUserInterface.draw();
// fade in at start of application
gl::enableAlphaBlending();
double t = math<double>::clamp( mTimer.getSeconds() / 3.0, 0.0, 1.0 );
float a = ci::lerp<float>(1.0f, 0.0f, (float) t);
if( a > 0.0f ) {
gl::color( ColorA(0,0,0,a) );
gl::drawSolidRect( getWindowBounds() );
}
gl::disableAlphaBlending();
}
示例2: draw
void StarsApp::draw()
{
int w = getWindowWidth();
int h = getWindowHeight();
gl::clear( Color::black() );
if(mIsStereoscopic) {
glPushAttrib( GL_VIEWPORT_BIT );
gl::pushMatrices();
// render left eye
mCamera.enableStereoLeft();
gl::setViewport( Area(0, 0, w / 2, h) );
gl::setMatrices( mCamera.getCamera() );
render();
// draw user interface
mUserInterface.draw("Stereoscopic Projection");
// render right eye
mCamera.enableStereoRight();
gl::setViewport( Area(w / 2, 0, w, h) );
gl::setMatrices( mCamera.getCamera() );
render();
// draw user interface
mUserInterface.draw("Stereoscopic Projection");
gl::popMatrices();
glPopAttrib();
}
else if(mIsCylindrical) {
// make sure we have a frame buffer to render to
createFbo();
// determine correct aspect ratio and vertical field of view for each of the 3 views
w = mFbo.getWidth() / 3;
h = mFbo.getHeight();
const float aspect = float(w) / float(h);
const float hFoV = 60.0f;
const float vFoV = toDegrees( 2.0f * math<float>::atan( math<float>::tan( toRadians(hFoV) * 0.5f ) / aspect ) );
// for values smaller than 1.0, this will cause each view to overlap the other ones
const float overlap = 1.0f;
// bind the frame buffer object
mFbo.bindFramebuffer();
// store viewport, camera and matrices, so we can restore later
glPushAttrib( GL_VIEWPORT_BIT );
CameraStereo original = mCamera.getCamera();
gl::pushMatrices();
// setup camera
CameraStereo cam = mCamera.getCamera();
cam.disableStereo();
cam.setAspectRatio(aspect);
cam.setFov( vFoV );
Vec3f right, up;
cam.getBillboardVectors(&right, &up);
Vec3f forward = up.cross(right);
// render left side
gl::setViewport( Area(0, 0, w, h) );
cam.setViewDirection( Quatf(up, overlap * toRadians(hFoV)) * forward );
cam.setWorldUp( up );
gl::setMatrices( cam );
render();
// render front side
gl::setViewport( Area(w, 0, w*2, h) );
cam.setViewDirection( forward );
cam.setWorldUp( up );
gl::setMatrices( cam );
render();
// draw user interface
mUserInterface.draw( (boost::format("Cylindrical Projection (%d degrees)") % int( (1.0f + 2.0f * overlap) * hFoV ) ).str() );
// render right side
gl::setViewport( Area(w*2, 0, w*3, h) );
cam.setViewDirection( Quatf(up, -overlap * toRadians(hFoV)) * forward );
cam.setWorldUp( up );
gl::setMatrices( cam );
render();
// unbind the frame buffer object
mFbo.unbindFramebuffer();
// restore states
gl::popMatrices();
mCamera.setCurrentCam(original);
//.........这里部分代码省略.........
示例3: draw
void StarsApp::draw()
{
float w = 0.5f * getWindowWidth();
float h = 1.0f * getWindowHeight();
gl::clear( Color::black() );
if(mIsStereoscopic) {
glPushAttrib( GL_VIEWPORT_BIT );
// render left eye
gl::setViewport( Area(0, 0, w, h) );
mCamera.enableStereoLeft();
gl::pushMatrices();
gl::setMatrices( mCamera.getCamera() );
{
// draw background
mBackground.draw();
// draw grid
if(mIsGridVisible)
mGrid.draw();
// draw stars
mStars.draw();
// draw constellations
if(mIsConstellationsVisible) {
mConstellations.draw();
mConstellationLabels.draw();
}
// draw labels
if(mIsLabelsVisible)
mLabels.draw();
}
gl::popMatrices();
// draw user interface
mUserInterface.draw();
// render right eye
gl::setViewport( Area(w, 0, w * 2.0f, h) );
mCamera.enableStereoRight();
gl::pushMatrices();
gl::setMatrices( mCamera.getCamera() );
{
// draw background
mBackground.draw();
// draw grid
if(mIsGridVisible)
mGrid.draw();
// draw stars
mStars.draw();
// draw constellations
if(mIsConstellationsVisible) {
mConstellations.draw();
mConstellationLabels.draw();
}
// draw labels
if(mIsLabelsVisible)
mLabels.draw();
}
gl::popMatrices();
// draw user interface
mUserInterface.draw();
glPopAttrib();
}
else {
mCamera.disableStereo();
gl::pushMatrices();
gl::setMatrices( mCamera.getCamera() );
{
// draw background
mBackground.draw();
// draw grid
if(mIsGridVisible)
mGrid.draw();
// draw stars
mStars.draw();
// draw constellations
if(mIsConstellationsVisible) {
mConstellations.draw();
mConstellationLabels.draw();
}
// draw labels
if(mIsLabelsVisible)
mLabels.draw();
}
gl::popMatrices();
//.........这里部分代码省略.........