本文整理汇总了C++中gl::GlslProgRef类的典型用法代码示例。如果您正苦于以下问题:C++ GlslProgRef类的具体用法?C++ GlslProgRef怎么用?C++ GlslProgRef使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GlslProgRef类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: bindShader
void ShaderToyApp::bindShader(gl::GlslProgRef shader)
{
// Nothing to bind if we don't have a shader.
if(!shader) return;
// Bind the shader.
shader->bind();
// Make sure it was successfull by checking for errors.
GLenum err = glGetError();
if(err != GL_NO_ERROR)
fatal("Failed to bind the shader!\n\nYour driver may not properly support shared contexts. Make sure you use the latest driver version and a proper GPU.");
// Calculate shader parameters.
Vec3f iResolution( Vec2f( getWindowSize() ), 1.f );
float iGlobalTime = (float) getElapsedSeconds();
float iChannelTime0 = (float) getElapsedSeconds();
float iChannelTime1 = (float) getElapsedSeconds();
float iChannelTime2 = (float) getElapsedSeconds();
float iChannelTime3 = (float) getElapsedSeconds();
Vec3f iChannelResolution0 = mChannel0 ? Vec3f( mChannel0->getSize(), 1.f ) : Vec3f::one();
Vec3f iChannelResolution1 = mChannel1 ? Vec3f( mChannel1->getSize(), 1.f ) : Vec3f::one();
Vec3f iChannelResolution2 = mChannel2 ? Vec3f( mChannel2->getSize(), 1.f ) : Vec3f::one();
Vec3f iChannelResolution3 = mChannel3 ? Vec3f( mChannel3->getSize(), 1.f ) : Vec3f::one();
time_t now = time(0);
tm* t = gmtime(&now);
Vec4f iDate( float(t->tm_year + 1900),
float(t->tm_mon + 1),
float(t->tm_mday),
float(t->tm_hour * 3600 + t->tm_min * 60 + t->tm_sec) );
// Set shader uniforms.
shader->uniform("iResolution", iResolution);
shader->uniform("iGlobalTime", iGlobalTime);
shader->uniform("iChannelTime[0]", iChannelTime0);
shader->uniform("iChannelTime[1]", iChannelTime1);
shader->uniform("iChannelTime[2]", iChannelTime2);
shader->uniform("iChannelTime[3]", iChannelTime3);
shader->uniform("iChannelResolution[0]", iChannelResolution0);
shader->uniform("iChannelResolution[1]", iChannelResolution1);
shader->uniform("iChannelResolution[2]", iChannelResolution2);
shader->uniform("iChannelResolution[3]", iChannelResolution3);
shader->uniform("iMouse", mMouse);
shader->uniform("iChannel0", 0);
shader->uniform("iChannel1", 1);
shader->uniform("iChannel2", 2);
shader->uniform("iChannel3", 3);
shader->uniform("iDate", iDate);
}
开发者ID:20SecondsToSun,项目名称:Cinder-Samples,代码行数:50,代码来源:ShaderToyApp.cpp
示例2: draw
void ShadowMappingBasic::draw()
{
renderDepthFbo();
gl::clear( Color::black() );
gl::setMatrices( mCam );
gl::ScopedTextureBind texScope( mShadowMapTex, (uint8_t) 0 );
vec3 mvLightPos = vec3( gl::getModelView() * vec4( mLightPos, 1.0f ) ) ;
mat4 shadowMatrix = mLightCam.getProjectionMatrix() * mLightCam.getViewMatrix();
mGlsl->uniform( "uShadowMap", 0 );
mGlsl->uniform( "uLightPos", mvLightPos );
mGlsl->uniform( "uShadowMatrix", shadowMatrix );
drawScene( false );
// Uncomment for debug
/*
gl::setMatricesWindow( getWindowSize() );
gl::color( 1.0f, 1.0f, 1.0f );
float size = 0.5f*std::min( getWindowWidth(), getWindowHeight() );
gl::draw( mShadowMapTex, Rectf( 0, 0, size, size ) );
*/
}
开发者ID:Ahbee,项目名称:Cinder,代码行数:26,代码来源:ShadowMappingBasicApp.cpp
示例3: dilateVelocity
void MotionBlurVelocityBufferApp::dilateVelocity()
{
gl::ScopedFramebuffer fbo( mVelocityDilationBuffer );
gl::ScopedViewport viewport( ivec2( 0, 0 ), mVelocityDilationBuffer->getSize() );
gl::ScopedMatrices matrices;
gl::setMatricesWindowPersp( mVelocityDilationBuffer->getSize() );
{ // downsample velocity into tilemax
gl::ScopedTextureBind tex( mGBuffer->getTexture2d( G_VELOCITY ), 0 );
gl::ScopedGlslProg prog( mTileProg );
gl::drawBuffer( DILATE_TILE_MAX );
mTileProg->uniform( "uVelocityMap", 0 );
mTileProg->uniform( "uTileSize", mTileSize );
gl::drawSolidRect( mVelocityDilationBuffer->getBounds() );
}
{ // build max neighbors from tilemax
gl::ScopedTextureBind tex( mVelocityDilationBuffer->getTexture2d( DILATE_TILE_MAX ), 0 );
gl::ScopedGlslProg prog( mNeighborProg );
gl::drawBuffer( DILATE_NEIGHBOR_MAX );
mNeighborProg->uniform( "uTileMap", 0 );
gl::drawSolidRect( mVelocityDilationBuffer->getBounds() );
}
}
开发者ID:cinder,项目名称:Cinder,代码行数:27,代码来源:MotionBlurVelocityBufferApp.cpp
示例4: loadShader
void MeshViewApp::loadShader(const std::string& fileName)
{
DBG_REMOVE(DBG_INFO);
DBG_REMOVE(DBG_ERROR);
try
{
std::string vertexFile = fileName + ".vert";
std::string fragmentFile = fileName + ".frag";
m_fileMonitorVert = FileMonitor::create(getAssetPath(vertexFile));
m_fileMonitorFrag = FileMonitor::create(getAssetPath(fragmentFile));
m_shader = gl::GlslProg::create(loadAsset(vertexFile), loadAsset(fragmentFile));
const std::string log = m_shader->getShaderLog(m_shader->getHandle());
if(log != std::string())
DBG(DBG_INFO, m_shader->getShaderLog(m_shader->getHandle()));
}
catch(gl::GlslProgCompileExc& e)
{
console() << "Shader load or compile error:" << std::endl;
console() << e.what() << std::endl;
DBG(DBG_ERROR, std::string(e.what()));
}
}
开发者ID:zulis,项目名称:Imrod,代码行数:25,代码来源:MeshViewApp.cpp
示例5: update
void SphericalStereoApp::update()
{
if( mRift ) {
hmd::ScopedRiftBuffer bind{ mRift };
gl::clear();
for( auto eye : mRift->getEyes() ) {
mRift->enableEye( eye );
const auto& pano = mPanos.at( mPanoIndex );
mStereoGlsl->uniform( "uDisplayMode", pano.mDisplayMode );
mStereoGlsl->uniform( "uRightEye", static_cast<int>(eye) );
gl::ScopedTextureBind tex0( pano.mLatLong );
mSphere->draw();
{
auto size = mRift->getFboSize();
gl::ScopedMatrices push;
gl::setMatricesWindow( size.x / 2, size.y );
vec3 latencies = mRift->getLatencies();
stringstream ss;
ss << mPanos.at( mPanoIndex ).mName << std::endl;
ss << " " << std::endl;
ss << "App fps: " << toString( getAverageFps() ) << std::endl;
ss << "Ren: " << latencies.x << std::endl;
ss << "TWrp: " << latencies.y << std::endl;
ss << "PostPresent: " << latencies.z << std::endl;
auto tbox = TextBox().text( ss.str() ).font( Font( "Arial", 20.0f ) ).color( Color::white() ).backgroundColor( Color::black() );
gl::draw( gl::Texture2d::create( tbox.render() ), vec2( size.x / 3, size.y / 2 ) );
}
}
}
}
开发者ID:marcopompili,项目名称:Cinder-OculusRift,代码行数:33,代码来源:SphericalStereoApp.cpp
示例6: update
void gpgpuFrameBufferApp::update()
{
//Using bind call
mBuffer->bindBuffer();
gl::viewport(mBuffer->getSize());
gl::setMatricesWindow( mBuffer->getSize() );
gl::clear();
mBuffer->bindTexture();
{
shader->bind();
shader->uniform( "pixel", vec2(1.0f)/vec2(mBuffer->getSize()) );
shader->uniform( "texBuffer", 0 );
gl::color(Color::white());
gl::drawSolidRect(Rectf(vec2(0.0f),mBuffer->getSize()));
}
mBuffer->unbindTexture();
if(mMouseDown)
{
gl::getStockShader(gl::ShaderDef().color())->bind();
//Red channel will host the injected force from mouse position
gl::color( ColorAf( 1.0f, 0.0f, 0.0f, 1.0f ) );
gl::drawSolidCircle( ( mMousePos ), 5.0f );
gl::color( Color::white() );
}
mBuffer->unbindBuffer(true);
}
开发者ID:eighteight,项目名称:CinderEight,代码行数:34,代码来源:gpgpuFrameBufferApp.cpp
示例7: draw
void gpgpuFrameBufferApp::draw()
{
gl::clear( Color( 0, 0, 0 ) );
gl::viewport(getWindowSize());
gl::setMatricesWindow( getWindowSize() );
gl::enableAdditiveBlending();
//using scoped
{
gl::ScopedTextureBind t0(mBuffer->getTexture(), 0);
gl::ScopedTextureBind t1(mTexture, 1);
gl::ScopedGlslProg sh(shaderRefraction);
shaderRefraction->uniform( "pixel", vec2(1.0f)/vec2(mBuffer->getSize()) );
shaderRefraction->uniform( "texBuffer", 0 );
shaderRefraction->uniform( "texRefract", 1 );
gl::drawSolidRect(getWindowBounds());
}
mBuffer->draw();
}
开发者ID:eighteight,项目名称:CinderEight,代码行数:26,代码来源:gpgpuFrameBufferApp.cpp
示例8: update
void TextParticlesApp::update()
{
if( !mActive )
return;
// Update particles on the GPU
gl::ScopedGlslProg prog( mUpdateProg );
gl::ScopedState rasterizer( GL_RASTERIZER_DISCARD, true ); // turn off fragment stage
mPerlin3dTex->bind(0);
mUpdateProg->uniform( "uPerlinTex", 0 );
mUpdateProg->uniform( "uStep", mStep.value() );
mUpdateProg->uniform( "uDampingSpeed", mDampingSpeed );
mUpdateProg->uniform( "uNoiseOffset", mNoiseOffset );
mUpdateProg->uniform( "uEndColor", mEndColor );
// Bind the source data (Attributes refer to specific buffers).
gl::ScopedVao source( mAttributes[mSourceIndex] );
// Bind destination as buffer base.
gl::bindBufferBase( GL_TRANSFORM_FEEDBACK_BUFFER, 0, mParticleBuffer[mDestinationIndex] );
gl::beginTransformFeedback( GL_POINTS );
// Draw source into destination, performing our vertex transformations.
gl::drawArrays( GL_POINTS, 0, mTextParticleCount );
gl::endTransformFeedback();
mPerlin3dTex->unbind();
// Swap source and destination for next loop
std::swap( mSourceIndex, mDestinationIndex );
}
开发者ID:gregkepler,项目名称:Cinder-Samples,代码行数:30,代码来源:TextParticlesApp.cpp
示例9: draw
void AudioVisualizerApp::draw()
{
gl::clear();
// use camera
gl::pushMatrices();
gl::setMatrices( mCamera );
{
// bind shader
gl::ScopedGlslProg shader( mShader );
mShader->uniform( "uTexOffset", mOffset / float( kHistory ) );
mShader->uniform( "uLeftTex", 0 );
mShader->uniform( "uRightTex", 1 );
// create textures from our channels and bind them
mTextureLeft = gl::Texture2d::create( mChannelLeft, mTextureFormat );
mTextureRight = gl::Texture2d::create( mChannelRight, mTextureFormat );
gl::ScopedTextureBind tex0( mTextureLeft, 0 );
gl::ScopedTextureBind tex1( mTextureRight, 1 );
// draw mesh using additive blending
gl::ScopedBlendAdditive blend;
gl::ScopedColor color( 1, 1, 1 );
gl::draw( mMesh );
}
gl::popMatrices();
}
开发者ID:UIKit0,项目名称:Cinder-Samples,代码行数:28,代码来源:AudioVisualizerApp.cpp
示例10: drawBridge
void BayBridgeApp::drawBridge(vec3 pColor, float pAmbient)
{
mShaderDiffuse->bind();
mShaderDiffuse->uniform("uColor", pColor);
mShaderDiffuse->uniform("uAmbient", pAmbient);
gl::drawCube(vec3(0, -2, 0), vec3(1050, 5, 30));
gl::drawCube(vec3(500, -25, 0), vec3(30,50,30));
gl::drawCube(vec3(-500, -25, 0), vec3(30, 50, 30));
gl::drawCube(vec3(0, 30, 0), vec3(5, 180, 50));
}
开发者ID:SethGibson,项目名称:BayBridge,代码行数:10,代码来源:BayBridgeApp.cpp
示例11: draw
void GeometryApp::draw()
{
// Prepare for drawing.
gl::clear();
gl::setMatrices( mCamera );
// Draw the grid.
if( mShowGrid && mGrid ) {
gl::ScopedGlslProg scopedGlslProg( gl::context()->getStockShader( gl::ShaderDef().color() ) );
// draw the coordinate frame with length 2.
gl::drawCoordinateFrame( 2 );
mGrid->draw();
}
if( mPrimitive ) {
gl::ScopedTextureBind scopedTextureBind( mTexture );
mPhongShader->uniform( "uTexturingMode", mTexturingMode );
// Rotate it slowly around the y-axis.
gl::ScopedModelMatrix matScope;
gl::rotate( float( getElapsedSeconds() / 5 ), 0, 1, 0 );
// Draw the normals.
if( mShowNormals && mPrimitiveNormalLines ) {
gl::ScopedColor colorScope( Color( 1, 1, 0 ) );
mPrimitiveNormalLines->draw();
}
// Draw the primitive.
gl::ScopedColor colorScope( Color( 0.7f, 0.5f, 0.3f ) );
if( mViewMode == WIREFRAME ) {
// We're using alpha blending, so render the back side first.
gl::ScopedAlphaBlend blendScope( false );
gl::ScopedFaceCulling cullScope( true, GL_FRONT );
mWireframeShader->uniform( "uBrightness", 0.5f );
mPrimitiveWireframe->draw();
// Now render the front side.
gl::cullFace( GL_BACK );
mWireframeShader->uniform( "uBrightness", 1.0f );
mPrimitiveWireframe->draw();
}
else
mPrimitive->draw();
}
// Render the parameter window.
#if ! defined( CINDER_GL_ES )
if( mParams )
mParams->draw();
#endif
}
开发者ID:ChristophPacher,项目名称:Cinder,代码行数:55,代码来源:GeometryApp.cpp
示例12: draw
void GeometryShaderIntroApp::draw()
{
gl::clear();
gl::setMatricesWindow( getWindowWidth(), getWindowHeight() );
gl::translate( getWindowCenter() );
gl::ScopedGlslProg glslProg( mGlsl );
mGlsl->uniform( "uNumSides", mNumSides );
mGlsl->uniform( "uRadius", mRadius );
mBatch->draw();
}
开发者ID:AbdelghaniDr,项目名称:Cinder,代码行数:12,代码来源:GeometryShaderBasicApp.cpp
示例13: setup
void BayBridgeApp::setup()
{
mGUI = params::InterfaceGl::create("Params", ivec2(300, 50));
mParamInvert = false;
mParamClear = true;
mGUI->addParam<bool>("paramInvert", &mParamInvert).optionsStr("label='Inverted'");
mGUI->addParam<bool>("paramClear", &mParamClear).optionsStr("label='Clear Frame'");
getWindow()->setSize(1280, 720);
getWindow()->setPos(ivec2(20));
setFrameRate(60);
mBridgeShader = gl::GlslProg::create(loadAsset("shaders/light_vert.glsl"), loadAsset("shaders/light_frag.glsl"));
mBridge.Init(mBridgeShader);
mCamera.setPerspective(45.0f, getWindowAspectRatio(), 10.0f, 10000.0f);
mCamera.lookAt(vec3(0, 50, -525), vec3(0,50,0), vec3(0, 1, 0));
mCamUi = CameraUi(&mCamera, getWindow());
mDS = CinderDSAPI::create();
mDS->init();
mDS->initDepth(FrameSize::DEPTHSD, 60);
mDS->start();
ImageSourceRef skybox[6]
{
loadImage(loadAsset("textures/px04.png")), loadImage(loadAsset("textures/nx04.png")),
loadImage(loadAsset("textures/py04.png")), loadImage(loadAsset("textures/ny04.png")),
loadImage(loadAsset("textures/pz04.png")), loadImage(loadAsset("textures/nz04.png"))
};
mTexSkybox = gl::TextureCubeMap::create(skybox);
mShaderSkybox = gl::GlslProg::create(loadAsset("shaders/skybox_vert.glsl"), loadAsset("shaders/skybox_frag.glsl"));
mBatchSkybox = gl::Batch::create(geom::Cube(), mShaderSkybox);
mBatchSkybox->getGlslProg()->uniform("uCubemapSampler", 0);
mShaderDiffuse = gl::GlslProg::create(loadAsset("shaders/diffuse_vert.glsl"), loadAsset("shaders/diffuse_frag.glsl"));
//Bloom
mFboRaw = gl::Fbo::create(1280, 720, gl::Fbo::Format().colorTexture(gl::Texture2d::Format().dataType(GL_FLOAT).internalFormat(GL_RGBA32F)));
mFboHiPass = gl::Fbo::create(1280, 720);
mFboBlurU = gl::Fbo::create(1280, 720);
mFboBlurV = gl::Fbo::create(1280, 720);
mShaderHiPass = gl::GlslProg::create(loadAsset("shaders/passthru_vert.glsl"), loadAsset("shaders/highpass_frag.glsl"));
mShaderHiPass->uniform("uTextureSampler", 0);
mShaderBlur = gl::GlslProg::create(loadAsset("shaders/blur_vert.glsl"), loadAsset("shaders/blur_frag.glsl"));
mShaderBlur->uniform("uTextureSampler", 0);
}
开发者ID:SethGibson,项目名称:BayBridge,代码行数:50,代码来源:BayBridgeApp.cpp
示例14: cos
void Day41App::update()
{
lightPos.x = (1.5f * cos(theta)) - 0.5;
lightPos.y = 2+ 1.5f * sin(theta);
lightPos.z = 1.5f;// * sin(theta*2);
theta += 0.0523;
eyePos = mCam.getEyePoint();
mGlsl->uniform("light.position", vec3(mCam.getViewMatrix() * vec4(lightPos, 1.0f)));
mGlsl->uniform("viewPos", vec3(mCam.getViewMatrix() * vec4(eyePos, 1.0f)));
vec3 lightColor = vec3(1.f);
vec3 diffuseColor = lightColor * vec3(0.9f);
vec3 ambientColor = diffuseColor * vec3(0.5f);
mGlsl->uniform("light.diffuse", diffuseColor);
mGlsl->uniform("light.specular", vec3(1.f));
mGlsl->uniform("material.ambient", vec3(1.0f, 0.5f, 0.31f));
mGlsl->uniform("material.diffuse", 0); //pass the diffuse map texture to shader
mGlsl->uniform("material.specular", 1); //pass the specular map texture to the shader
mGlsl->uniform("material.shininess", 32.f);
}
开发者ID:Craigson,项目名称:100days,代码行数:28,代码来源:Day41App.cpp
示例15: draw
void AudioObjApp::draw()
{
gl::clear( Color( 0, 0, 0 ) );
gl::enableAlphaBlending();
gl::enableDepthRead();
gl::enableDepthWrite();
gl::pushMatrices();
gl::setMatrices( mMayaCam.getCamera() );
if ( mFeature && mFeatureTex )
{
mShader->bind();
mFeatureTex.enableAndBind();
mShader->uniform( "dataTex", 0 );
mShader->uniform( "texWidth", (float)mFeatureTex.getWidth() );
mShader->uniform( "texHeight", (float)mFeatureTex.getHeight() );
mShader->uniform( "soundDataSize", (float)mFeature->getSize() );
mShader->uniform( "spread", mFeatureSpread );
mShader->uniform( "spreadOffset", mFeatureSpreadOffset );
mShader->uniform( "time", (float)getElapsedSeconds() );
mShader->uniform( "tintColor", mObjColor );
}
if ( mRenderWireframe )
gl::enableWireframe();
gl::color( Color(1.0f, 0.0f, 0.0f ) );
if ( mVbo )
gl::draw( mVbo );
if ( mRenderWireframe )
gl::disableWireframe();
mShader->unbind();
mFeatureTex.unbind();
gl::color( Color::white() );
// gl::drawCoordinateFrame();
gl::popMatrices();
gl::disableDepthRead();
gl::disableDepthWrite();
gl::setMatricesWindow( getWindowSize() );
ciXtractReceiver::drawData( mFeature, Rectf( 15, getWindowHeight() - 150, 255, getWindowHeight() - 35 ) );
gl::draw( mFeatureSurf );
mParams->draw();
}
开发者ID:deniskovalev,项目名称:ciResonate,代码行数:55,代码来源:AudioObjApp.cpp
示例16: drawBlurredContent
void MotionBlurVelocityBufferApp::drawBlurredContent()
{
gl::ScopedTextureBind colorTex( mGBuffer->getTexture2d( G_COLOR ), 0 );
gl::ScopedTextureBind velTex( mGBuffer->getTexture2d( G_VELOCITY ), 1 );
gl::ScopedTextureBind neigborTex( mVelocityDilationBuffer->getTexture2d( DILATE_NEIGHBOR_MAX ), 2 );
gl::ScopedGlslProg prog( mMotionBlurProg );
gl::ScopedBlendPremult blend;
mMotionBlurProg->uniform( "uColorMap", 0 );
mMotionBlurProg->uniform( "uVelocityMap", 1 );
mMotionBlurProg->uniform( "uNeighborMaxMap", 2 );
mMotionBlurProg->uniform( "uNoiseFactor", mBlurNoise );
mMotionBlurProg->uniform( "uSamples", mSampleCount );
gl::drawSolidRect( getWindowBounds() );
}
开发者ID:cinder,项目名称:Cinder,代码行数:16,代码来源:MotionBlurVelocityBufferApp.cpp
示例17: draw
void ProfilerTestApp::draw()
{
CI_SCOPED_CPU( mCpuProfiler, "Draw" );
CI_SCOPED_GPU( mGpuProfiler, "Draw" );
gl::clear();
// Expensive CPU operation
for( size_t i = 0; i < 20000; ++i ) {
Rand::randVec3();
}
// Expensive GPU pass
{
CI_SCOPED_GPU( mGpuProfiler, "Noise pass" );
gl::ScopedGlslProg s( mNoiseShader );
mNoiseShader->uniform( "uTime", (float)app::getElapsedSeconds() );
gl::drawSolidRect( app::getWindowBounds() );
}
// More gpu work...
gl::drawSolidCircle( app::getWindowSize()/2, 100.0f, 50000 );
CI_CHECK_GL();
}
开发者ID:gaborpapp,项目名称:Cinder-Profiler,代码行数:25,代码来源:ProfilerTestApp.cpp
示例18: update
void TransformFeedbackClothSimulationApp::update()
{
gl::ScopedGlslProg updateScope( mUpdateGlsl );
gl::ScopedState stateScope( GL_RASTERIZER_DISCARD, true );
// This for loop allows iteration on the gpu of solving the
// physics of the cloth.
// Change mIterationsPerFrame to see the difference it makes
for( int i = mIterationsPerFrame; i != 0; --i ) {
// Pick using the mouse if it's pressed
if( mouseMoving ) {
mUpdateGlsl->uniform( "mouse_pos", currentMousePosition );
mouseMoving = false;
}
gl::ScopedVao vaoScope( mVaos[mIterationIndex & 1] );
gl::ScopedTextureBind textureBind( mPosBufferTextures[mIterationIndex & 1]->getTarget(),
mPosBufferTextures[mIterationIndex & 1]->getId() );
mIterationIndex++;
mFeedbackObjs[mIterationIndex & 1]->bind();
gl::beginTransformFeedback( GL_POINTS );
gl::drawArrays( GL_POINTS, 0, POINTS_TOTAL );
gl::endTransformFeedback();
}
}
开发者ID:ChristophPacher,项目名称:Cinder,代码行数:28,代码来源:TransformFeedbackClothSimulationApp.cpp
示例19: resize
void GeometryApp::resize()
{
mCamera.setAspectRatio( getWindowAspectRatio() );
if( mWireframeShader )
mWireframeShader->uniform( "uViewportSize", vec2( getWindowSize() ) );
}
开发者ID:Ahbee,项目名称:Cinder,代码行数:7,代码来源:GeometryApp.cpp
示例20: draw
void ShaderLoadingApp::draw()
{
// Clear the window
gl::clear( Color( 0, 0, 0 ) );
// Set a perspective projection matrix and center
// the drawing at the center of the window
gl::setMatricesWindowPersp( getWindowSize() );
gl::translate( getWindowCenter() );
// Draw a sphere and use our shader if available.
// Wrapping the shader code into a "if" block ensure
// that it won't be used if the shader hasn't been validated.
if( mShader ) mShader->bind();
gl::drawSphere( Vec3f::zero(), 180, 36 );
if( mShader ) mShader->unbind();
}
开发者ID:SethGibson,项目名称:CinderAndScriptsClass,代码行数:17,代码来源:ShaderLoadingApp.cpp
注:本文中的gl::GlslProgRef类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论