本文整理汇总了C++中drawSphere函数的典型用法代码示例。如果您正苦于以下问题:C++ drawSphere函数的具体用法?C++ drawSphere怎么用?C++ drawSphere使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了drawSphere函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ofSetWindowTitle
//--------------------------------------------------------------
void testApp::draw(){
ofSetWindowTitle(ofToString(ofGetFrameRate()));
camera.begin();
for (int i = 0; i < fingerPos.size(); i++) {
ofVec3f pt;
pt = fingerPos[i];
drawSphere(pt, 3);
}
ofVec3f pt = ofVec3f(0);
drawSphere(pt, 7);
// if (phase2 && (!spherePos.empty())) {
// ofVec3f temp = spherePos[0];
// temp.z = -90;
// drawSphere(temp, 20);
// }
// if (phase3 && (!sphereSize.empty())) {
// ofVec3f pt = ofVec3f(0,0);
// pt.z = -150;
// drawSphere(pt, sphereSize[0]);
// }
camera.end();
}
示例2: glPushMatrix
void SampleModel::drawFace() {
glPushMatrix();
// eyes
glTranslated(0.2, UPPER_TORSO_RADIUS + HEAD_RADIUS + 0.3, 0.7);
if (VAL(TEXTURESKIN))
drawTextureSphere(0.1);
else drawSphere(0.1);
glTranslated(-0.4, 0, 0);
if (VAL(TEXTURESKIN))
drawTextureSphere(0.1);
else drawSphere(0.1);
// nose
setDiffuseColor(.940f, .816f, .811f);
glTranslated( 0.2, -0.3, 0.1);
if (VAL(TEXTURESKIN))
drawTextureSphere(0.1);
else drawSphere(0.1);
glPopMatrix();
// mouth
glPushMatrix();
setDiffuseColor(1.0f, 0.0f, 0.0f);
glTranslated(-0.25, UPPER_TORSO_RADIUS + 0.3, 0.7);
glRotated(20, 1.0, 0.0, 0.0);
glTranslated(0.0, 0.0, -0.05);
if (VAL(TEXTURESKIN))
drawTextureBox(0.5,0.3,0);
else drawBox(0.5,0.3,0);
glPopMatrix();
}
示例3: drawBanana1
void drawBanana1(void)
{
mvstack.push(model_view);
set_colour(.95, .9, .8);
model_view *= Scale(0.08, 0.2, 0.1);
model_view *= RotateX(90);
drawSphere();
model_view = mvstack.pop();
mvstack.push(model_view);
set_colour(.95, .9, .1);
model_view *= Scale(0.1, 0.3, 0.112);
model_view *= Translate (0, -.5, 0);
model_view *= RotateX(90);
drawSphere();
model_view = mvstack.pop();
mvstack.push(model_view);
set_colour (.1, .1, .2);
model_view *= Translate(0, -0.45, 0);
model_view *= Scale(.025, .025,.025);
drawSphere();
model_view = mvstack.pop();
}
示例4: drawHead1
void drawHead1(void)
{
//head
mvstack.push(model_view);
set_colour(.95, .9, .75);
drawSphere();
model_view = mvstack.pop();
//eyes
mvstack.push(model_view);
set_colour(.1,.1,.1);
model_view *= Translate(-.27, .3, .7);
model_view *= Scale(.2, .2, .2);
drawSphere();
model_view = mvstack.pop();
mvstack.push(model_view);
set_colour(.1,.1,.1);
model_view *= Translate(.27, .3, .7);
model_view *= Scale(.2, .2, .2);
drawSphere();
model_view = mvstack.pop();
}
示例5: sizeof
void GFXDrawUtil::_drawSolidCapsule( const GFXStateBlockDesc &desc, const Point3F ¢er, F32 radius, F32 height, const ColorI &color, const MatrixF *xfm )
{
MatrixF mat;
if ( xfm )
mat = *xfm;
else
mat = MatrixF::Identity;
S32 numPoints = sizeof(circlePoints)/sizeof(Point2F);
GFXVertexBufferHandle<GFXVertexPC> verts(mDevice, numPoints * 2 + 2, GFXBufferTypeVolatile);
verts.lock();
for (S32 i=0; i<numPoints + 1; i++)
{
S32 imod = i % numPoints;
verts[2 * i].point = Point3F( circlePoints[imod].x * radius, circlePoints[imod].y * radius, height );
verts[2 * i].color = color;
verts[2 * i + 1].point = Point3F( circlePoints[imod].x * radius, circlePoints[imod].y * radius, -height );
verts[2 * i + 1].color = color;
}
S32 totalNumPnts = numPoints * 2 + 2;
// Apply xfm if we were passed one.
for ( U32 i = 0; i < totalNumPnts; i++ )
mat.mulP( verts[i].point );
// Apply position offset
for ( U32 i = 0; i < totalNumPnts; i++ )
verts[i].point += center;
verts.unlock();
mDevice->setStateBlockByDesc( desc );
mDevice->setVertexBuffer( verts );
mDevice->setupGenericShaders();
mDevice->drawPrimitive( GFXTriangleStrip, 0, 2 * numPoints );
Point3F sphereCenter;
MatrixF sphereMat;
if ( xfm )
sphereMat = *xfm;
else
sphereMat = MatrixF::Identity;
sphereCenter.set( 0, 0, 0.5f * height );
mat.mulV( sphereCenter );
sphereCenter += center;
drawSphere( desc, radius, sphereCenter, color, true, false, &sphereMat );
sphereCenter.set( 0, 0, -0.5f * height );
mat.mulV( sphereCenter );
sphereCenter += center;
drawSphere( desc, radius, sphereCenter, color, false, true, &sphereMat );
}
示例6: glColor3f
void World::draw(RenderMode render_mode)
{
if (render_mode == NORMAL) {
#ifndef PICTURE
for (int i = 0; i<cursors.size(); i++)
cursors[i]->draw();
for (int i = 0; i<objs.size(); i++)
objs[i]->draw();
#else
vector<EndEffector*> end_effs;
getObjects<EndEffector>(end_effs);
if (end_effs.size() > 0)
end_effs[0]->draw();
if (end_effs.size() > 1) {
glColor3f(0.3, 0.3, 0.3);
drawSphere(end_effs[1]->getPosition(), 4.0);
}
if (end_effs.size() > 2)
end_effs[2]->draw();
if (end_effs.size() > 3) {
glColor3f(0.3, 0.3, 0.3);
drawSphere(end_effs[3]->getPosition(), 4.0);
}
if (end_effs.size() > 4)
end_effs[4]->draw();
vector<InfinitePlane*> planes;
getObjects<InfinitePlane>(planes);
if (planes.size() > 0)
planes[0]->draw();
#endif
for (int i = 0; i<threads.size(); i++)
threads[i]->draw(false);
} else if (render_mode == EXAMINE) {
for (int i = 0; i<cursors.size(); i++)
cursors[i]->draw();
for (int i = 0; i<objs.size(); i++)
objs[i]->draw();
for (int i = 0; i<threads.size(); i++)
threads[i]->draw(true);
} else if (render_mode == DEBUG) {
for (int i = 0; i<cursors.size(); i++)
cursors[i]->draw();
for (int i = 0; i<threads.size(); i++)
threads[i]->drawDebug();
for (int i = 0; i<objs.size(); i++)
objs[i]->drawDebug();
} else {
if (collision_world != NULL) {
btCollisionObjectArray col_objs = collision_world->collision_world->getCollisionObjectArray();
glColor3f(0,0.8,0.6);
for (int i = 0; i < col_objs.size(); i++) {
drawCapsule(col_objs[i], true);
}
}
}
if (collision_world != NULL)
collision_world->drawAllCollisions();
}
示例7: glClear
void System::drawAll(){
if(updateDraw){
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_DEPTH_TEST);
glFrontFace(GL_CCW);
glCullFace(GL_BACK);
glEnable(GL_CULL_FACE);
glDepthFunc(GL_LEQUAL);
glClearDepth(1.0);
glPointSize(2);
glLoadIdentity();
float4 pitch_quat=CreateFromAxisAngle(cross(dir,camera_up), camera_pitch);
float4 heading_quat=CreateFromAxisAngle(camera_up, camera_heading);
dir=quatRotate(dir,normalize(mult(pitch_quat,heading_quat)));
camera_pos+=camera_pos_delta;
look_at=camera_pos+dir*1;
camera_heading*=.5;
camera_pitch*=.5;
camera_pos_delta*=.5;
gluLookAt(
camera_pos.x, camera_pos.y, camera_pos.z,
look_at.x, look_at.y, look_at.z,
camera_up.x, camera_up.y, camera_up.z);
for(int i=0; i<mSystem->Get_bodylist()->size(); i++){
ChBody* abody=mSystem->Get_bodylist()->at(i);
if(abody->GetCollisionModel()->GetShapeType()==SPHERE){
drawSphere((abody)->GetPos(),(abody)->GetPos_dt().Length(), mSphereRadius);
}
if(abody->GetCollisionModel()->GetShapeType()==BOX){
drawBox(abody,mSphereRadius,mGPUSys);
}
if(abody->GetCollisionModel()->GetShapeType()==ELLIPSOID){
drawSphere(abody,mGPUSys);
}
if(abody->GetCollisionModel()->GetShapeType()==TRIANGLEMESH){
glColor3f (0,0,0);
drawTriMesh(TriMesh,(abody));
}
}
#if defined( _WINDOWS )
Sleep( 30 );
#else
usleep( 30 * 1000 );
#endif
glutSwapBuffers();
}
}
示例8: glColor3f
void Needle::draw()
{
glColor3f(color0, color1, color2);
int obj_ind;
for (obj_ind = 0; obj_ind<i_objs.size(); obj_ind++) {
drawCylinder(i_objs[obj_ind]->_start_pos, i_objs[obj_ind]->_end_pos, i_objs[obj_ind]->_radius);
drawSphere(i_objs[obj_ind]->_start_pos, i_objs[obj_ind]->_radius);
}
drawSphere(i_objs[obj_ind-1]->_end_pos, i_objs[obj_ind-1]->_radius);
glColor3f(1,0,0);
drawSphere(i_objs[0]->_start_pos, i_objs[0]->_radius);
}
示例9: drawHelixLine
void drawHelixLine(float cx, float cy, float r, float angle=180)
{
float x1, x2, y1, y2, z1, z2, theta;
int i, n = 565, k=0;
GLubyte colors[2][3];
angle = angle * PI / 180.0;
for(i=0; i<n; i+=n/10)
{
theta = 2.0 * PI * i / n;
x1 = cx - (r * sinf(1 * theta));
y1 = cy + i;
z1 = r * cosf(1 * theta);
x2 = cx - (r * sinf(1 * theta + angle));
y2 = cy + i;
z2 = r * cosf(1 * theta + angle);
switch(k)
{
case 0: colors[0][0] = 46; colors[0][1] = 204; colors[0][2] = 113; //turquoise
colors[1][0] = 249; colors[1][1] = 148; colors[1][2] = 6; //orange
break;
case 1: colors[0][0] = 249; colors[0][1] = 191; colors[0][2] = 59; //yellow
colors[1][0] = 155; colors[1][1] = 89; colors[1][2] = 182; //amethyst
break;
case 2: colors[0][0] = 249; colors[0][1] = 148; colors[0][2] = 6;
colors[1][0] = 46; colors[1][1] = 204; colors[1][2] = 113;
break;
case 3: colors[0][0] = 155; colors[0][1] = 89; colors[0][2] = 182;
colors[1][0] = 249; colors[1][1] = 191; colors[1][2] = 59;
}
glBegin(GL_LINE_STRIP);
glColor3ubv(colors[0]);
glVertex3f(x1, y1, z1);
glVertex3f((x1+x2)/2, (y1+y2)/2, (z1+z2)/2);
glColor3ubv(colors[1]);
glVertex3f((x1+x2)/2, (y1+y2)/2, (z1+z2)/2);
glVertex3f(x2, y2, z2);
glEnd();
glColor3ub(52, 73, 94);
drawSphere(x1, y1, z1);
drawSphere(x2, y2, z2);
k++;
if (k>3) k=0;
}
}
示例10: glDisable
void CPolyOff6_11::displayEvent()
{
GLfloat gray[] = { 0.8, 0.8, 0.8, 1.0 };
GLfloat black[] = { 0.0, 0.0, 0.0, 1.0 };
glDisable(GL_LIGHTING);
glDisable(GL_LIGHT0);
CLearnOpenGLBase::displayEvent();
drawSphere(radius * 2 + 0.1, radius * 2 + 0.1, 0, true);
drawSphere(-radius * 2 + 0.1, radius * 2 + 0.1, 0, false);
glutSwapBuffers();
}
示例11: createFurnishings
void createFurnishings()
{
glTranslatef(0, -height + 2 * wide / 8, - Dept+2 * Dept / 8);
drawSphere();
glTranslatef(0, height - 2 * wide / 8, Dept - 2 * Dept / 8);
cone();
}
示例12: createLightAndProxy
void createLightAndProxy(GLenum mode)
{
glTranslatef(2 * movex / wide_screen, 2 * movey / height_screen, 2 * movez / wide_screen);
glLightf(GL_LIGHT0, GL_CONSTANT_ATTENUATION, 1.5);
glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION, 0);
glLightfv(GL_LIGHT0, GL_POSITION, light_postion);
glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient);
glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse);
glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular);
if(mode == GL_SELECT)
{
glLoadName(1);
}
if(flag_light == 1)
drawSphere(proxy[0], proxy[1] - wide / 12, proxy[2], 1);
glTranslatef( -2 * movex / wide_screen, -2 * movey / height_screen, -2 * movez / wide_screen);
if(mode == GL_SELECT)
{
glLoadName(2);
}
}
示例13: drawTopArm2Right
void drawTopArm2Right(void)
{
mvstack.push(model_view);
set_colour(.95, .9, .75);
model_view *= Translate (.75, -1.25, 0);
model_view *= Scale(.25, .5, .25);
drawSphere();
model_view = mvstack.pop();
mvstack.push(model_view);
set_colour(.95, .9, .75);
model_view *= Translate (.75, -2, 0);
model_view *= Scale(.25, .3, .25);
drawSphere();
model_view = mvstack.pop();
}
示例14: drawFlower
void drawFlower()
{
float theta;
mvstack.push(model_view);
for (int i = 0; i <8; i++){
theta =5*sin(30*DegreesToRadians*TIME);
model_view *= RotateZ(theta);
model_view *= Translate(0.0f, 1, 0.0f);
mvstack.push(model_view);
model_view *= Scale(1, 2, 1);
set_colour(0.545f, 0.271f, 0.075f);
drawCube();
model_view = mvstack.top();
mvstack.pop();
model_view *= Translate(0.0f, 1, 0.0f);
if (i == 7)
{
model_view *= RotateZ(theta);
model_view *= Translate(0, 2, 0);
model_view *= Scale(2, 2, 2);
set_colour(1.0f, 0.0f, 0.0f);
drawSphere();
}
}
model_view = mvstack.top();
mvstack.pop();
}
示例15: glutDisplay
void glutDisplay (void)
{
if (!winH)
return;
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode (GL_MODELVIEW);
glLoadIdentity ();
glTranslatef (0, 0, -50); /* eye position */
drawFace ();
drawSphere ();
glutSwapBuffers();
}