MCPcopy Create free account
hub / github.com/cinder/Cinder / draw

Method draw

samples/Geometry/src/GeometryApp.cpp:190–270  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

188}
189
190void 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 {

Callers

nothing calls this directly

Calls 13

setMatricesFunction · 0.85
enableDepthReadFunction · 0.85
enableDepthWriteFunction · 0.85
cullFaceFunction · 0.85
disableDepthWriteFunction · 0.85
drawCoordinateFrameFunction · 0.85
disableDepthReadFunction · 0.85
uniformMethod · 0.80
colorMethod · 0.80
clearFunction · 0.50
ColorFunction · 0.50
contextFunction · 0.50

Tested by

no test coverage detected