| 188 | } |
| 189 | |
| 190 | void GeometryApp::draw() |
| 191 | { |
| 192 | // Prepare for drawing. |
| 193 | gl::clear(); |
| 194 | gl::setMatrices( mCamera ); |
| 195 | |
| 196 | // Enable the depth buffer. |
| 197 | gl::enableDepthRead(); |
| 198 | gl::enableDepthWrite(); |
| 199 | |
| 200 | if( mPrimitive ) { |
| 201 | gl::ScopedTextureBind scopedTextureBind( mTexture ); |
| 202 | mPhongShader->uniform( "uTexturingMode", mTexturingMode ); |
| 203 | mPhongShader->uniform( "uFreq", ( mPrimitiveCurrent == TORUSKNOT ) ? ivec2( 100, 10 ) : ivec2( 20 ) ); |
| 204 | |
| 205 | // Rotate it slowly around the y-axis. |
| 206 | gl::ScopedModelMatrix matScope; |
| 207 | //gl::rotate( float( getElapsedSeconds() / 5 ), 0, 1, 0 ); |
| 208 | |
| 209 | // Draw the normals. |
| 210 | if( mShowNormals && mPrimitiveNormalLines ) { |
| 211 | gl::ScopedColor colorScope( Color( 1, 1, 0 ) ); |
| 212 | mPrimitiveNormalLines->draw(); |
| 213 | } |
| 214 | |
| 215 | // Draw the tangents. |
| 216 | if( mShowTangents && mPrimitiveTangentLines ) { |
| 217 | gl::ScopedColor colorScope( Color( 0, 1, 0 ) ); |
| 218 | mPrimitiveTangentLines->draw(); |
| 219 | } |
| 220 | |
| 221 | // Draw the wire primitive. |
| 222 | if( mShowWirePrimitive && mPrimitiveWire ) { |
| 223 | gl::ScopedColor color( Color( 1, 1, 1 ) ); |
| 224 | gl::ScopedLineWidth linewidth( 2.5f ); |
| 225 | |
| 226 | mPrimitiveWire->draw(); |
| 227 | } |
| 228 | |
| 229 | // Draw the primitive. |
| 230 | if( mShowSolidPrimitive ) { |
| 231 | gl::ScopedColor colorScope( Color( 1, 1, 1 ) ); |
| 232 | |
| 233 | if( mViewMode == WIREFRAME ) { |
| 234 | // We're using alpha blending, so render the back side first. |
| 235 | gl::ScopedBlendAlpha blendScope; |
| 236 | gl::ScopedFaceCulling cullScope( true, GL_FRONT ); |
| 237 | |
| 238 | mWireframeShader->uniform( "uBrightness", 0.5f ); |
| 239 | mPrimitiveWireframe->draw(); |
| 240 | |
| 241 | // Now render the front side. |
| 242 | gl::cullFace( GL_BACK ); |
| 243 | |
| 244 | mWireframeShader->uniform( "uBrightness", 1.0f ); |
| 245 | mPrimitiveWireframe->draw(); |
| 246 | } |
| 247 | else { |
nothing calls this directly
no test coverage detected