本文整理汇总了C++中params::InterfaceGlRef类的典型用法代码示例。如果您正苦于以下问题:C++ InterfaceGlRef类的具体用法?C++ InterfaceGlRef怎么用?C++ InterfaceGlRef使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了InterfaceGlRef类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setup
void RDiffusionApp::setup()
{
mReactionU = 0.25f;
mReactionV = 0.04f;
mReactionK = 0.047f;
mReactionF = 0.1f;
mMousePressed = false;
// Setup the parameters
mParams = params::InterfaceGl::create( "Parameters", ivec2( 175, 100 ) );
mParams->addParam( "Reaction u", &mReactionU, "min=0.0 max=0.4 step=0.01 keyIncr=u keyDecr=U" );
mParams->addParam( "Reaction v", &mReactionV, "min=0.0 max=0.4 step=0.01 keyIncr=v keyDecr=V" );
mParams->addParam( "Reaction k", &mReactionK, "min=0.0 max=1.0 step=0.001 keyIncr=k keyDecr=K" );
mParams->addParam( "Reaction f", &mReactionF, "min=0.0 max=1.0 step=0.001 keyIncr=f keyDecr=F" );
mCurrentFBO = 0;
mOtherFBO = 1;
mFBOs[0] = gl::Fbo::create( FBO_WIDTH, FBO_HEIGHT, gl::Fbo::Format().colorTexture().disableDepth() );
mFBOs[1] = gl::Fbo::create( FBO_WIDTH, FBO_HEIGHT, gl::Fbo::Format().colorTexture().disableDepth() );
mRDShader = gl::GlslProg::create( loadResource( RES_PASS_THRU_VERT ), loadResource( RES_GSRD_FRAG ) );
mTexture = gl::Texture::create( loadImage( loadResource( RES_STARTER_IMAGE ) ),
gl::Texture::Format().wrap(GL_REPEAT).magFilter(GL_LINEAR).minFilter(GL_LINEAR) );
gl::getStockShader( gl::ShaderDef().texture() )->bind();
resetFBOs();
}
示例2: setup
void TweakBarApp::setup()
{
mObjSize = 4;
mLightDirection = vec3( 0, 0, -1 );
mColor = ColorA( 0.25f, 0.5f, 1, 1 );
mSomeValue = 2;
// Setup our default camera, looking down the z-axis
mCam.lookAt( vec3( -20, 0, 0 ), vec3( 0 ) );
// Create the interface and give it a name.
mParams = params::InterfaceGl::create( getWindow(), "App parameters", toPixels( ivec2( 200, 400 ) ) );
// Setup the parameters
mParams->addParam( "Cube Size", &mObjSize ).min( 0.1f ).max( 20.5f ).keyIncr( "z" ).keyDecr( "Z" ).precision( 2 ).step( 0.02f );
mParams->addParam( "Cube Rotation", &mObjOrientation );
mParams->addParam( "Cube Color", &mColor );
mParams->addParam( "String ", &mString );
mParams->addSeparator();
// Attach a callback that is fired after a target is updated.
mParams->addParam( "some value", &mSomeValue ).updateFn( [this] { console() << "new value: " << mSomeValue << std::endl; } );
// Add a param with no target, but instead provide setter and getter functions.
std::function<void( vec3 )> setter = std::bind( &TweakBarApp::setLightDirection, this, std::placeholders::_1 );
std::function<vec3 ()> getter = std::bind( &TweakBarApp::getLightDirection, this );
mParams->addParam( "Light Direction", setter, getter );
// Other types of controls that can be added to the interface
mParams->addButton( "Button!", std::bind( &TweakBarApp::button, this ) );
mParams->addText( "text", "label=`This is a label without a parameter.`" );
}
示例3: initGui
void AudioObjApp::initGui()
{
mParams = params::InterfaceGl::create( "Settings", Vec2f( 200, 250 ) );
mParams->addParam( "Obj color", &mObjColor );
mParams->addParam( "Wireframe", &mRenderWireframe );
mParams->addParam( "Data Gain", &mFeatureGain, "min=0.0 max=25.0 step=0.1" );
mParams->addParam( "Data Offset", &mFeatureOffset, "min=-1.0 max=1.0 step=0.01" );
mParams->addParam( "Data Damping", &mFeatureDamping, "min=0.0 max=0.99 step=0.01" );
mParams->addParam( "Spread", &mFeatureSpread, "min=0.0 max=1.0 step=0.01" );
mParams->addParam( "Spread Offset", &mFeatureSpreadOffset, "min=0.0 max=1.0 step=0.01" );
}
示例4: update
void WaterSimulationApp::update(){
////change status
float dt = 1.f/60.0f;
if(mAnimate){
if(randomForce.lengthSquared()>0 && mAddNewForce) addForce(dt);
fluidsys->step(dt);
mParams->setOptions("status","label=`In animation:`");
}else{
mParams->setOptions("status","label=`Idle:`");
}
}
示例5: initGui
void BasicReceiverApp::initGui()
{
mParams = params::InterfaceGl::create( "Settings", Vec2f( 220, 200 ) );
mParams->addParam( "Data Gain", &mDataGain, "min=0.0 max=100.0 step=0.1" );
mParams->addParam( "Data Offset", &mDataOffset, "min=-1.0 max=1.0 step=0.01" );
mParams->addParam( "Data Damping", &mDataDamping, "min=0.0 max=0.99 step=0.01" );
mParams->addParam( "Use log", &mDataIsLog );
mParams->addParam( "Spread", &mDataSpread, "min=0.0 max=1.0 step=0.01" );
mParams->addParam( "Spread Offset", &mDataSpreadOffset, "min=0.0 max=1.0 step=0.01" );
mParams->addParam( "Feature", mAvailableFeatures, &mActiveFeature );
}
示例6: setup
void PointCloudApp::setup()
{
mCamUi = CameraUi(&mCam);
gl::enable( GL_TEXTURE_2D );
mFrameRate = 0.0f;
mFullScreen = false;
mTimeStamp = 0L;
mTimeStampPrev = mTimeStamp;
loadGlsl();
mDevice = Kinect2::Device::create();
mDevice->start();
mDevice->connectColorEventHandler( [ & ]( const Kinect2::ColorFrame& frame )
{
mSurfaceColor = frame.getSurface();
} );
mDevice->connectDepthEventHandler( [ & ]( const Kinect2::DepthFrame& frame )
{
mChannelDepth = frame.getChannel();
mTimeStamp = frame.getTimeStamp();
} );
//////////////////////////////////////////////////////////////////////////////////////////////
ivec2 sz = Kinect2::DepthFrame().getSize();
vector<vec2> vertices;
for ( int32_t x = 0; x < sz.x; ++x ) {
for ( int32_t y = 0; y < sz.y; ++y ) {
vertices.push_back( vec2( x, y ) / vec2( sz ) );
}
}
gl::VboRef vbo = gl::Vbo::create( GL_ARRAY_BUFFER, vertices.size() * sizeof( vec2 ), &vertices[ 0 ], GL_STATIC_DRAW );
geom::BufferLayout layout;
layout.append( geom::Attrib::POSITION, 2, sizeof( vec2 ), 0 );
vector<pair<geom::BufferLayout, gl::VboRef>> vertexArrayBuffers = { make_pair( layout, vbo ) };
mVboMesh = gl::VboMesh::create( vertices.size(), GL_POINTS, vertexArrayBuffers );
//////////////////////////////////////////////////////////////////////////////////////////////
mParams = params::InterfaceGl::create( "Params", ivec2( 200, 120 ) );
mParams->addParam( "Frame rate", &mFrameRate, "", true );
mParams->addParam( "Full screen", &mFullScreen ).key( "f" );
mParams->addButton( "Load GLSL", [ & ]() { loadGlsl(); }, "key=g" );
mParams->addButton( "Quit", [ & ]() { quit(); }, "key=q" );
resize();
}
示例7: setupParams
void PinballWarpingApp::setupParams()
{
mParams = params::InterfaceGl::create("params", ivec2(300,300));
mParams->addParam("FPS", &mFps);
mParams->addSeparator();
mParams->addParam("Draw Image", &mDrawImage);
mParams->addParam("Debugging", &mPinball.mDebug);
mParams->addParam("Editing Locations", &mPinball.mIsInEditingMode).updateFn([this] {
if (!mPinball.mDebug)
mPinball.saveJson();
});
}
示例8: setup
void MotionBlurVelocityBufferApp::setup()
{
mBackground = gl::Texture::create( loadImage( loadAsset( "background.jpg" ) ) );
mGpuTimer = gl::QueryTimeSwapped::create();
gl::enableVerticalSync();
createGeometry();
createBuffers();
loadShaders();
#if ! defined( CINDER_ANDROID )
mParams = params::InterfaceGl::create( "Motion Blur Options", ivec2( 250, 300 ) );
mParams->addParam( "Average GPU Draw (ms)", &mAverageGpuTime );
mParams->addParam( "Average CPU Draw (ms)", &mAverageCpuTime );
mParams->addSeparator();
mParams->addParam( "Enable Blur", &mBlurEnabled );
mParams->addParam( "Show Velocity Buffers", &mDisplayVelocityBuffers );
mParams->addParam( "Pause Animation", &mPaused );
mParams->addParam( "Animation Speed", &mAnimationSpeed ).min( 0.05f ).step( 0.2f );
mParams->addParam( "Max Samples", &mSampleCount ).min( 1 ).step( 2 );
mParams->addParam( "Blur Noise", &mBlurNoise ).min( 0.0f ).step( 0.01f );
#endif
#if defined( CINDER_COCOA_TOUCH )
getSignalSupportedOrientations().connect( [] { return InterfaceOrientation::LandscapeAll; } );
#endif
}
示例9: draw
void ciApp::draw()
{
gl::clear();
gl::ScopedColor white(Color::white());
auto get_center_rect = [&](Area area) ->Rectf { return Rectf(area).getCenteredFit(getWindowBounds(), true); };
{
//auto tex = filter->getTexture();
auto tex = vector_blur.getTexture();
gl::draw(tex, get_center_rect(tex->getBounds()));
}
{
gl::ScopedMatrices scpMatrix;
gl::scale(0.2f, 0.2f);
gl::draw(mTexture);
}
vector_blur.drawDebug(vec2(0, 0), 0.2f);
mParams->draw();
{
TextLayout infoFps;
infoFps.clear(ColorA(0.2f, 0.2f, 0.2f, 0.5f));
infoFps.setColor(Color::white());
infoFps.setFont(Font("Arial", 16));
infoFps.setBorder(4, 2);
infoFps.addLine("App Framerate: " + tostr(getAverageFps(), 1));
auto tex = gl::Texture::create(infoFps.render(true));
gl::draw(tex, ivec2(20, getWindowHeight() - tex->getHeight() - 20));
}
}
示例10: draw
void TextParticlesApp::draw()
{
gl::clear( Color( 0, 0, 0 ) );
gl::color( 1, 1, 1 );
gl::enableAlphaBlending();
{
gl::ScopedMatrices scpMtrx;
// SET matrices so that by default, we are looking at a rect the size of the window
lookAtTexture( mCam, getWindowSize() );
gl::translate( mTextSize * vec2( -0.5 ) );
gl::ScopedDepth scpDepth( true );
// gl::ScopedColor scpColor( 1, 0, 0 );
// gl::drawStrokedRect( Rectf( 0, 0, mTextSize.x, mTextSize.y ) );
gl::color( Color::white() );
if( mActive ){
gl::ScopedGlslProg render( mRenderProg );
gl::ScopedVao vao( mAttributes[mSourceIndex] );
gl::context()->setDefaultShaderVars();
gl::drawArrays( GL_POINTS, 0, mTextParticleCount );
}else{
if( mString.length() > 0 )
gl::draw( mTextFbo->getColorTexture() );
}
}
mParams->draw();
}
示例11: draw
void OpenCVTemplateApp::draw()
{
gl::clear( Color( 0, 0, 0 ) );
if(imageTexture) {
unsigned int windowWidth = this->getWindow()->getWidth();
unsigned int windowHeight = this->getWindow()->getHeight();
gl::pushMatrices();
gl::translate((windowWidth-image.cols)/2, (windowHeight-image.rows)/2);
gl::draw(imageTexture);
gl::popMatrices();
}
if(frameTexture) {
gl::pushMatrices();
unsigned int windowWidth = this->getWindow()->getWidth();
unsigned int windowHeight = this->getWindow()->getHeight();
gl::translate((windowWidth-frameWidth)/2, (windowHeight-frameHeight)/2);
gl::draw(frameTexture);
if(featurePoints.size() > 0) {
gl::color(1,0,0);
for(auto& p : featurePoints) {
gl::drawSolidCircle(fromOcv(p), 1);
}
gl::color(1,1,1);
}
gl::popMatrices();
}
interface->draw();
}
示例12: draw
void cApp::draw(){
bOrtho ? mExp.beginOrtho( true ) : mExp.begin( camUi.getCamera() ); {
gl::clear();
gl::enableDepthRead();
gl::enableDepthWrite();
gl::enableAlphaBlending();
glPointSize(1);
glLineWidth(1);
if( !mExp.bRender && !mExp.bSnap ){ mt::drawCoordinate(10); }
for( int i=0; i<rms.size(); i++){
rms[rms.size()-i-1].draw();
}
norms.draw();
}mExp.end();
mExp.draw();
if(gui) gui->draw();
if( bStart && !bFall )frame++;
}
示例13: draw
void FlockingApp::draw()
{
gl::clear( Color( 0, 0, 0 ), true );
gl::enableDepthRead();
gl::enableDepthWrite();
// DRAW PARTICLES
mParticleController.draw();
// DRAW ZONE DIAGRAM
gl::disableDepthRead();
gl::disableDepthWrite();
gl::setMatricesWindow( getWindowSize() );
gl::pushModelView();
gl::translate( Vec3f( 117.0f, getWindowHeight() - 117.0f, 0.0f ) );
gl::color( ColorA( 0.25f, 0.25f, 1.0f, 1.0f ) );
gl::drawSolidCircle( Vec2f::zero(), mZoneRadius );
gl::color( ColorA( 1.0f, 1.0f, 1.0f, 0.25f ) );
gl::drawStrokedCircle( Vec2f::zero(), 100.0f );
gl::popModelView();
// DRAW PARAMS WINDOW
mParams->draw();
}
示例14: draw
void ForestApp::draw()
{
gl::clear( Color::gray(0.9f) );
float wallWidth = getWindowWidth() * 0.75;
float wallHeight = wallWidth / mStrandBox.mBorderRect.getAspectRatio();
Vec2f wallSize(wallWidth, wallHeight);
Vec2f wallTopLeft = getWindowCenter() - wallSize/2;
// Wall coordinate system, Y=0 at bottom with +Y in growth direction
gl::pushModelView();
gl::translate(wallTopLeft.x, wallTopLeft.y + wallHeight);
gl::scale(wallWidth, -wallWidth);
// Drawing should be safe without acquiring the mutex (performance)
mStrandBox.draw();
mDots.draw();
mPanels.draw();
gl::popModelView();
if (mShowMatrix) {
mDots.drawAffinityMatrix();
}
mParams->draw();
}
示例15: draw
void WaterSimulationApp::draw(){
gl::clear( Color( 0.11f, 0.13f, 0.1f ) );
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
mParams->draw();
gl::setMatrices(mMayaCam.getCamera());
if(mDrawBox){
glColor4f(0.2, 0.4, 0.5, 1);//orange
gl::drawStrokedCube(boxCenter,boxDimension);
}
if(mDrawGravity){
glColor4f(1.0f,0.3f,0.0f,0.5f);//red
if(mDrawGravity)glColor4f(0.0f,1.0f,0.5f,1);//green
gl::drawVector(boxCenter,(boxCenter-gravity),3.0f,1.0f);
}
//draw random force
if(mDrawForce){
if(randomForce.lengthSquared()!=0){
glColor4f(1.0f,0.0f,0.0f,1);
gl::drawVector(randomForceX,randomForce+randomForceX,1.0f,0.5f);
}
}
fluidsys->draw();
}