| 283 | } |
| 284 | |
| 285 | void NormalMappingApp::draw() |
| 286 | { |
| 287 | // clear the window |
| 288 | gl::clear(); |
| 289 | gl::color( Color::white() ); |
| 290 | |
| 291 | if( isInitialized() ) { |
| 292 | // get ready to draw in 3D |
| 293 | gl::pushMatrices(); |
| 294 | gl::setMatrices( mCamera ); |
| 295 | |
| 296 | gl::enableDepthRead(); |
| 297 | gl::enableDepthWrite(); |
| 298 | |
| 299 | // bind textures |
| 300 | mDiffuseMap->bind(0); |
| 301 | mSpecularMap->bind(1); |
| 302 | mNormalMap->bind(2); |
| 303 | mEmissiveMap->bind(3); |
| 304 | |
| 305 | // render our model |
| 306 | #if ! defined( CINDER_GL_ES ) |
| 307 | if( mViewMode == ViewMode::Mesh && mShaderWireframe ) { |
| 308 | // use our wireframe shader for this scope |
| 309 | gl::ScopedGlslProg glslProgScope( mShaderWireframe ); |
| 310 | |
| 311 | gl::pushModelMatrix(); |
| 312 | gl::multModelMatrix( mMeshTransform ); |
| 313 | gl::draw( mMesh ); |
| 314 | gl::popModelMatrix(); |
| 315 | } |
| 316 | else |
| 317 | #endif |
| 318 | { |
| 319 | // use our own normal mapping shader for this scope |
| 320 | gl::ScopedGlslProg GlslProgScope( mShaderNormalMapping ); |
| 321 | |
| 322 | gl::pushModelMatrix(); |
| 323 | gl::multModelMatrix( mMeshTransform ); |
| 324 | gl::draw( mMesh ); |
| 325 | gl::popModelMatrix(); |
| 326 | } |
| 327 | |
| 328 | // render normals, tangents and bitangents if necessary |
| 329 | if( mShowNormalsAndTangents ) { |
| 330 | // use a default shader for this scope |
| 331 | gl::ScopedGlslProg glslProgScope( gl::getStockShader( gl::ShaderDef().color() ) ); |
| 332 | |
| 333 | gl::pushModelMatrix(); |
| 334 | gl::multModelMatrix( mMeshTransform ); |
| 335 | gl::draw( mMeshDebug ); |
| 336 | gl::popModelMatrix(); |
| 337 | } |
| 338 | |
| 339 | // get ready to render in 2D again |
| 340 | gl::disableDepthWrite(); |
| 341 | gl::disableDepthRead(); |
| 342 |
nothing calls this directly
no test coverage detected