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

Method draw

test/ArcballTest/src/ArcballTestApp.cpp:108–152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106}
107
108void ArcballTestApp::draw()
109{
110 CameraPersp &cam = ( mUsingCameraUi ) ? mDebugCam : mCam;
111 gl::clear( Color( 0, 0.0f, 0.15f ) );
112 gl::setMatrices( cam );
113
114 // draw the earth
115 gl::enableDepthRead();
116 gl::enableDepthWrite();
117 gl::translate( mEarthSphere.getCenter() );
118 gl::rotate( mArcball.getQuat() );
119 mEarthTex->bind();
120 mEarth->draw();
121
122 // draw constraint axis
123 if( mArcball.isUsingConstraint() ) {
124 gl::setMatrices( cam );
125 gl::color( 1, 1, 0 );
126 gl::translate( mEarthSphere.getCenter() );
127 gl::rotate( glm::rotation( vec3( 0, 1, 0 ), mArcball.getConstraintAxis() ) );
128 mConstraintAxis->draw();
129 }
130
131 gl::disableDepthRead();
132
133 // draw from vector marker
134 gl::setMatrices( cam );
135 gl::color( 0, 1, 0.25f );
136 gl::translate( mEarthSphere.getCenter() + mArcball.getFromVector() * mEarthSphere.getRadius() );
137 mMarker->draw();
138
139 // draw to vector marker
140 gl::setMatrices( cam );
141 gl::color( 1, 0.5f, 0.25f );
142 gl::translate( mEarthSphere.getCenter() + mArcball.getToVector() * mEarthSphere.getRadius() );
143 mMarker->draw();
144
145 // draw the elliptical axes
146 gl::setMatricesWindow( getWindowSize() );
147 gl::color( 1, 0, 0 );
148 vec2 center, axisA, axisB;
149 mCam.calcScreenProjection( mEarthSphere, getWindowSize(), &center, &axisA, &axisB );
150 gl::drawLine( center - axisA, center + axisA );
151 gl::drawLine( center - axisB, center + axisB );
152}
153
154CINDER_APP( ArcballTestApp, RendererGl )

Callers

nothing calls this directly

Calls 15

setMatricesFunction · 0.85
enableDepthReadFunction · 0.85
enableDepthWriteFunction · 0.85
disableDepthReadFunction · 0.85
setMatricesWindowFunction · 0.85
calcScreenProjectionMethod · 0.80
clearFunction · 0.50
ColorFunction · 0.50
translateFunction · 0.50
rotateFunction · 0.50
colorFunction · 0.50
getWindowSizeFunction · 0.50

Tested by

no test coverage detected