本文整理汇总了C++中ci::gl::Texture类的典型用法代码示例。如果您正苦于以下问题:C++ Texture类的具体用法?C++ Texture怎么用?C++ Texture使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Texture类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Color
void Fluid2DTextureApp::draw()
{
// clear out the window with black
gl::clear( Color( 0, 0, 0 ) );
gl::setMatricesWindow( getWindowWidth(), getWindowHeight() );
// Update the positions and tex coords
Rectf drawRect = getWindowBounds();
int limX = mFluid2D.resX() - 1;
int limY = mFluid2D.resY() - 1;
float dx = drawRect.getWidth()/(float)limX;
float dy = drawRect.getHeight()/(float)limY;
for( int j = 0; j < mFluid2D.resY(); ++j ) {
for( int i = 0; i < mFluid2D.resX(); ++i ) {
Vec2f P = Vec2f( i*dx, j*dy );
Vec2f uv = mFluid2D.texCoordAt( i, j );
int idx = j*mFluid2D.resX() + i;
mTriMesh.getVertices()[idx] = P;
mTriMesh.getTexCoords()[idx] = uv;
}
}
mTex.bind();
gl::draw( mTriMesh );
mTex.unbind();
mParams.draw();
}
开发者ID:fieldOfView,项目名称:CinderFx,代码行数:31,代码来源:Fluid2DTextureApp.cpp
示例2: drawPumpkin
void Pumpkin::drawPumpkin(const ci::gl::Texture & PumpkinTexture)
{
PumpkinTexture.bind();
ci::gl::translate(mPos);
ci::gl::rotate(ci::Vec3f(180.f, 0.f, 0.f));
ci::gl::drawCube(ci::Vec3f(ci::Vec3f::zero()), mSize);
PumpkinTexture.unbind();
}
开发者ID:masashi37,项目名称:DowaProject,代码行数:8,代码来源:Pumpkin.cpp
示例3: drawTownwindow
void TownwindowHit::drawTownwindow(const ci::gl::Texture& mTownwindowTexture)
{
mTownwindowTexture.bind();
ci::gl::translate(mPos);
ci::gl::rotate(ci::Vec3f(180.f, 0.f, 0.f));
ci::gl::drawCube(ci::Vec3f(ci::Vec3f::zero()), mSize);
mTownwindowTexture.unbind();
}
开发者ID:masashi37,项目名称:DowaProject,代码行数:8,代码来源:TownwindowHit.cpp
示例4:
void King2::drawKing2(const ci::gl::Texture& texture)
{
texture.bind();
ci::gl::translate(mPos);
ci::gl::rotate(mRotate);
ci::gl::drawCube(ci::Vec3f(ci::Vec3f::zero()), mSize);
texture.unbind();
}
开发者ID:masashi37,项目名称:DowaProject,代码行数:8,代码来源:king2.cpp
示例5: onColorData
// Receives Color data
void MeshApp::onColorData( Surface8u surface, const DeviceOptions& deviceOptions )
{
if ( mTextureColor ) {
mTextureColor.update( surface, surface.getBounds() );
} else {
mTextureColor = gl::Texture( surface );
mTextureColor.setWrap( GL_REPEAT, GL_REPEAT );
}
}
开发者ID:Asteral,项目名称:Cinder-KinectSdk,代码行数:10,代码来源:MeshApp.cpp
示例6: uniformTexture
void Shader::uniformTexture( const std::string &name, ci::gl::Texture tex, int slot )
{
glActiveTexture( GL_TEXTURE0 + slot );
glEnable( tex.getTarget() );
glBindTexture( tex.getTarget(), tex.getId() );
glDisable( tex.getTarget() );
GLint loc = getUniformLocation( name );
glUniform1i( loc, slot );
glActiveTexture( GL_TEXTURE0 );
}
开发者ID:simongeilfus,项目名称:Cinder-Shader,代码行数:12,代码来源:Shader.cpp
示例7: drawCinderella
void Cinderella::drawCinderella(const ci::gl::Texture & texture, const ci::Vec3f& offset)
{
ci::gl::pushModelView();
texture.bind();
ci::gl::translate(mPos);
ci::gl::rotate(mRotate);
ci::gl::translate(offset);
ci::gl::drawCube(ci::Vec3f(ci::Vec3f::zero()), mSize);
texture.unbind();
ci::gl::popModelView();
}
开发者ID:masashi37,项目名称:DowaProject,代码行数:13,代码来源:Cinderella.cpp
示例8: draw
// Render
void MeshApp::draw()
{
// Set up window
gl::clear( ColorAf::black(), true );
gl::setMatrices( mCamera );
gl::color( ColorAf::white() );
// Check texture and VBO
if ( mTextureDepth && mTextureColor && mVboMesh ) {
// Position world
gl::pushMatrices();
gl::scale( -1.0f, -1.0f, -1.0f );
gl::rotate( mRotation );
// Bind textures
mTextureDepth.bind( 0 );
mTextureColor.bind( 1 );
// Bind and configure shader
mShader.bind();
mShader.uniform( "brightTolerance", mBrightTolerance );
mShader.uniform( "eyePoint", mEyePoint );
mShader.uniform( "lightAmbient", mLightAmbient );
mShader.uniform( "lightDiffuse", mLightDiffuse );
mShader.uniform( "lightPosition", mLightPosition );
mShader.uniform( "lightSpecular", mLightSpecular );
mShader.uniform( "positions", 0 );
mShader.uniform( "scale", mScale );
mShader.uniform( "showColor", mShowColor );
mShader.uniform( "shininess", mLightShininess );
mShader.uniform( "Color", 1 );
mShader.uniform( "ColorOffset", Vec2f( mColorOffsetX, mColorOffsetY ) );
mShader.uniform( "uvmix", mMeshUvMix );
// Draw VBO
gl::draw( mVboMesh );
// Stop drawing
mShader.unbind();
mTextureDepth.unbind();
mTextureColor.unbind();
gl::popMatrices();
}
// Draw params
params::InterfaceGl::draw();
}
开发者ID:Asteral,项目名称:Cinder-KinectSdk,代码行数:52,代码来源:MeshApp.cpp
示例9: init
void SpriteSheet::init(ci::gl::Texture spriteImage, std::string xmlPath, int DataFormat){
__spriteData = SpriteDataParser::parseSpriteData(xmlPath, DataFormat);
__spriteImage = spriteImage;
__currentFrame = 0;
__totalFrames = __spriteData.size();
__textureWidth = spriteImage.getWidth();
__textureHeight = spriteImage.getHeight();
x = 0;
y = 0;
scale = 1.0f;
rotation = 0.0f;
alpha = 1.0f;
}
开发者ID:proalias,项目名称:ee_app,代码行数:15,代码来源:SpriteSheet.cpp
示例10: unbindTexture
void BulletTestApp::unbindTexture( uint32_t index )
{
if ( mTest > 4 ) {
if ( index == 0 ) {
mTexTerrain.unbind();
} else {
if ( mTest < 7 ) {
mTexSphere.unbind();
}
}
} else {
if ( ( ( mTest == 0 || mTest == 3 ) && index > 0 ) || mTest == 1 ) {
mTexSquare.unbind();
}
}
}
开发者ID:bgbotond,项目名称:Cinder-Bullet,代码行数:16,代码来源:BulletTestApp.cpp
示例11: update
void ClientApp::update()
{
mClient.poll();
mFrameRate = getFrameRate();
if ( mFullScreen != isFullScreen() ) {
setFullScreen( mFullScreen );
}
double e = getElapsedSeconds();
if ( mPing && e - mPingTime > 3.0 ) {
mClient.ping();
mPingTime = e;
}
if ( mTextPrev != mText ) {
mTextPrev = mText;
if ( mText.empty() ) {
mTexture.reset();
} else {
TextBox tbox = TextBox().alignment( TextBox::CENTER ).font( mFont ).size( Vec2i( mSize.x, TextBox::GROW ) ).text( mText );
tbox.setColor( ColorAf( 1.0f, 0.8f, 0.75f, 1.0f ) );
tbox.setBackgroundColor( ColorAf::black() );
tbox.setPremultiplied( false );
mSize.y = tbox.measure().y;
mTexture = gl::Texture( tbox.render() );
}
}
}
开发者ID:araid,项目名称:Cinder-WebSocketPP,代码行数:30,代码来源:ClientApp.cpp
示例12: onVideoData
// Receives video data
void SkeletonBitmapApp::onVideoData( Surface8u surface, const DeviceOptions &deviceOptions )
{
if ( mTexture ) {
mTexture.update( surface );
} else {
mTexture = gl::Texture( surface );
}
}
开发者ID:joshuajnoble,项目名称:Cinder-KinectSdk,代码行数:9,代码来源:SkeletonBitmapApp.cpp
示例13: setup
void BulletTestApp::setup()
{
mDragging = false;
mFrameRate = 0.0f;
mTest = 9;
mTestPrev = mTest;
// Set up lighting
mLight = new gl::Light( gl::Light::DIRECTIONAL, 0 );
mLight->setDirection( Vec3f( 0.0f, 0.1f, 0.3f ).normalized() );
mLight->setAmbient( ColorAf( 0.2f, 0.2f, 0.2f, 1.0f ) );
mLight->setDiffuse( ColorAf( 1.0f, 1.0f, 1.0f, 1.0f ) );
mLight->enable();
// Load meshes
loadModels();
// Create a Bullet dynamics world
mWorld = bullet::createWorld();
// Load texture
mTexSquare = gl::Texture( loadImage( loadResource( RES_TEX_SQUARE ) ) );
mTexSphere = gl::Texture( loadImage( loadResource( RES_TEX_SPHERE ) ) );
mTexTerrain = gl::Texture( loadImage( loadResource( RES_TEX_TERRAIN ) ) );
mTexTerrain.setWrap( GL_REPEAT, GL_REPEAT );
mTexTerrain.unbind();
// Init terrain pointer
mTerrain = 0;
// Parameters
mParams = params::InterfaceGl( "Params", Vec2i( 200, 120 ) );
mParams.addParam( "Frame Rate", &mFrameRate, "", true );
mParams.addParam( "Test", &mTest, "min=0 max=9 step=1 keyDecr=t keyIncr=T" );
mParams.addButton( "Drop", bind( &BulletTestApp::drop, this ), "key=space" );
mParams.addButton( "Screen shot", bind( &BulletTestApp::screenShot, this ), "key=s" );
mParams.addButton( "Quit", bind( &BulletTestApp::quit, this ), "key=q" );
// Initialize
initTest();
// Run first resize to initialize view
resize( ResizeEvent( getWindowSize() ) );
}
开发者ID:degatt2,项目名称:Cinder-Bullet,代码行数:45,代码来源:BulletTestApp.cpp
示例14: draw
void FloorView::draw()
{
const ci::gl::Texture fbotex = fbo.getTexture();
gl::enableAdditiveBlending();
fbotex.enableAndBind();
//draw fbo with shader
shader->bind();
shader->uniform( "alpha", alpha->value() );
drawQuad();
shader->unbind();
fbotex.unbind();
gl::enableAlphaBlending();
}
开发者ID:trippedout,项目名称:argos,代码行数:18,代码来源:FloorView.cpp
示例15: setup
void BulletTestApp::setup()
{
// Set test mode
mTest = 0;
mTestPrev = mTest;
// Set up lighting
mLight = new gl::Light( gl::Light::DIRECTIONAL, 0 );
mLight->setDirection( Vec3f( 0.0f, 0.1f, 0.3f ).normalized() );
mLight->setAmbient( ColorAf( 0.2f, 0.2f, 0.2f, 1.0f ) );
mLight->setDiffuse( ColorAf( 1.0f, 1.0f, 1.0f, 1.0f ) );
mLight->enable();
// Load meshes
loadModels();
// Create a Bullet dynamics world
mWorld = bullet::createWorld();
// Load texture
mTexSquare = gl::Texture( loadImage( loadResource( RES_TEX_SQUARE ) ) );
mTexSphere = gl::Texture( loadImage( loadResource( RES_TEX_SPHERE ) ) );
mTexTerrain = gl::Texture( loadImage( loadResource( RES_TEX_TERRAIN ) ) );
mTexTerrain.setWrap( GL_REPEAT, GL_REPEAT );
mTexTerrain.unbind();
// Init terrain pointer
mTerrain = 0;
// Parameters
mFrameRate = 0.0f;
mParams = params::InterfaceGl( "Params", Vec2i( 150, 100) );
mParams.addParam( "Frame Rate", &mFrameRate, "", true );
mParams.addParam( "Test", &mTest, "min=0 max=7 step=1 keyDecr=d keyIncr=D" );
// Initialize
initTest();
// Run first resize to initialize view
resize( ResizeEvent( getWindowSize() ) );
}
开发者ID:bgbotond,项目名称:Cinder-Bullet,代码行数:43,代码来源:BulletTestApp.cpp
示例16: ImageButtonSpriteRef
KeyBackground::KeyBackground(const Vec2f& initPosition, const ci::gl::Texture& closeKeyboard, const ci::ColorA& color)
:alphaColorPlashka(0.0f),
showing(false),
initPosition(initPosition),
plashkaHeight(592.0f),
bgHeight(1920.0f - 592.0f - initPosition.x),
closeKeyboard(closeKeyboard)
{
#ifdef PORTRAIT_RES
auto positionY = 885.0f - closeKeyboard.getHeight() * 0.5f;
#else
auto positionY = 600.0f - closeKeyboard.getHeight() * 0.5f;
#endif
auto positionX = (1080.0f - closeKeyboard.getWidth()) * 0.5f;
btn = ImageButtonSpriteRef(new ImageButtonSprite(closeKeyboard));
btn->setPosition(initPosition + Vec2f(positionX, positionY));
addChild(btn);
mainColor = color;
}
开发者ID:20SecondsToSun,项目名称:KUBIK,代码行数:21,代码来源:KeyBackground.cpp
示例17: draw
void MovieLoaderTestApp::draw()
{
// clear out the window with black
gl::clear( Color( 0, 0, 0 ) );
if (!mMovieSelected) return;
if (mTexture) {
Rectf centeredRect = Rectf( mTexture.getBounds() ).getCenteredFit( getWindowBounds(), true );
gl::draw(mTexture, centeredRect);
}
}
开发者ID:jihyunlee,项目名称:Cinder-AvfImpl,代码行数:12,代码来源:MovieLoaderTest.cpp
示例18: draw
// Render
void SkeletonBitmapApp::draw()
{
// Clear window
gl::setViewport( getWindowBounds() );
gl::clear();
gl::setMatricesWindow( getWindowSize() );
// We're capturing
if ( mKinect->isCapturing() && mTexture ) {
// Draw color image
gl::color( ColorAf::white() );
gl::draw( mTexture, getWindowBounds() );
// Scale skeleton to fit
gl::pushMatrices();
gl::scale( Vec2f( getWindowSize() ) / Vec2f( mTexture.getSize() ) );
// Iterate through skeletons
uint32_t i = 0;
for ( vector<Skeleton>::const_iterator skeletonIt = mSkeletons.cbegin(); skeletonIt != mSkeletons.cend(); ++skeletonIt, i++ ) {
// Set color
gl::color( mKinect->getUserColor( i ) );
// Draw bones and joints
for ( Skeleton::const_iterator boneIt = skeletonIt->cbegin(); boneIt != skeletonIt->cend(); ++boneIt ) {
// Get joint positions
const Bone& bone = boneIt->second;
Vec3f position = bone.getPosition();
Vec3f destination = skeletonIt->at( bone.getStartJoint() ).getPosition();
Vec2f positionScreen = Vec2f( mKinect->getSkeletonVideoPos( position ) );
Vec2f destinationSceen = Vec2f( mKinect->getSkeletonVideoPos( destination ) );
// Draw bone
gl::drawLine( positionScreen, destinationSceen );
// Draw joint
gl::drawSolidCircle( positionScreen, 10.0f, 16 );
}
}
gl::popMatrices();
}
}
开发者ID:joshuajnoble,项目名称:Cinder-KinectSdk,代码行数:52,代码来源:SkeletonBitmapApp.cpp
示例19: draw
void LocationOrbitalOverlay::draw()
{
const ci::gl::Texture fbotex = mFbo->getTexture();
gl::enableAdditiveBlending();
mShader->bind();
fbotex.bind(0);
mSphereAlpha->getTexture()->bind(1);
mShader->uniform("mapTexture", 0);
mShader->uniform("alphaTexture", 1);
drawQuad();
fbotex.unbind(0);
mSphereAlpha->getTexture()->unbind(1);
mShader->unbind();
gl::enableAlphaBlending();
}
开发者ID:trippedout,项目名称:argos,代码行数:24,代码来源:LocationOrbitalOverlay.cpp
示例20: chan
void Fluid2DBasicApp::draw()
{
// clear out the window with black
gl::clear( Color( 0, 0, 0 ) );
Channel32f chan( mFluid2D.resX(), mFluid2D.resY(), mFluid2D.resX()*sizeof(float), 1, const_cast<float*>( mFluid2D.density().data() ) );
if( ! mTex ) {
mTex = gl::Texture( chan );
} else {
mTex.update( chan );
}
gl::color( Color( 1, 1, 1 ) );
gl::draw( mTex, getWindowBounds() );
mParams.draw();
}
开发者ID:fieldOfView,项目名称:CinderFx,代码行数:17,代码来源:Fluid2DBasicApp.cpp
注:本文中的ci::gl::Texture类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论