本文整理汇总了C++中drawSphere函数的典型用法代码示例。如果您正苦于以下问题:C++ drawSphere函数的具体用法?C++ drawSphere怎么用?C++ drawSphere使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了drawSphere函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
}
开发者ID:shgfl007,项目名称:myApps,代码行数:26,代码来源:testApp.cpp
示例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();
}
开发者ID:andreajeka,项目名称:HKUST_Animator,代码行数:35,代码来源:sample.cpp
示例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();
}
开发者ID:yabbadabbadoo1,项目名称:opengl-animation-test,代码行数:26,代码来源:anim.cpp
示例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();
}
开发者ID:yabbadabbadoo1,项目名称:opengl-animation-test,代码行数:25,代码来源:anim.cpp
示例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 );
}
开发者ID:mray,项目名称:terminal-overload,代码行数:60,代码来源:gfxDrawUtil.cpp
示例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();
}
开发者ID:bo-wu,项目名称:surgical,代码行数:59,代码来源:World.cpp
示例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();
}
}
开发者ID:DavidHammen,项目名称:chrono,代码行数:55,代码来源:demo_gpuCD.cpp
示例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);
}
开发者ID:rll,项目名称:surgical,代码行数:12,代码来源:Needle.cpp
示例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;
}
}
开发者ID:lakshyaranganath,项目名称:cgDna,代码行数:50,代码来源:main.cpp
示例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();
}
开发者ID:PatchLion,项目名称:OpenGL,代码行数:15,代码来源:PolyOff6_11.cpp
示例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();
}
开发者ID:lc4t,项目名称:OtherFiles,代码行数:7,代码来源:3.2.cpp
示例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);
}
}
开发者ID:lc4t,项目名称:OtherFiles,代码行数:25,代码来源:3.2.cpp
示例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();
}
开发者ID:yabbadabbadoo1,项目名称:opengl-animation-test,代码行数:16,代码来源:anim.cpp
示例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();
}
开发者ID:4solo,项目名称:cs174,代码行数:28,代码来源:anim.cpp
示例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();
}
开发者ID:lunixbochs,项目名称:minorgems-gles,代码行数:31,代码来源:texture.cpp
示例16: round
/** Render initial_state */
void ParticleSystem::drawParticles(float t)
{
if (simulate){
float roundedTime = round(t*bake_fps) / bake_fps;
Particle* p = particles;
// check if the initial_state are already baked at this time
if (!bakedParticles.empty() && bakedParticles.count(roundedTime)){
p = bakedParticles.at(roundedTime);
}
// draw shape
double size = 0.05;
float grayColor = (rand() % 100) / 100.0;
setDiffuseColor(grayColor,grayColor,grayColor);
for (int i = 0; i < n; i++){
float* location = p[i].getPositionVectors();
glPushMatrix();
glTranslated(location[0], location[1], location[2]);
glTranslated(-size / 2, -size / 2, -size / 2);
drawSphere(size);
//drawBox(size, size, size);
glPopMatrix();
}
}
}
开发者ID:andriantolie,项目名称:Animator,代码行数:27,代码来源:particleSystem.cpp
示例17: glEnable
void PointSet::Draw ( float* view_mat, float rad )
{
char* dat;
Point* p;
glEnable ( GL_NORMALIZE );
if ( m_Param[PNT_DRAWMODE] == 0 ) {
glLoadMatrixf ( view_mat );
dat = mBuf[0].data;
for (int n = 0; n < NumPoints(); n++) {
p = (Point*) dat;
glPushMatrix ();
glTranslatef ( p->pos.x, p->pos.y, p->pos.z );
glScalef ( 0.2, 0.2, 0.2 );
if(p->type == 0)
glColor4f ( 0.1,0.3,1.0,1.0 );//glColor4f ( RED(p->clr), GRN(p->clr), BLUE(p->clr), ALPH(p->clr) );
else
glColor4f ( RED(p->clr), GRN(p->clr), BLUE(p->clr), 0.0 );
drawSphere ();
glPopMatrix ();
dat += mBuf[0].stride;
}
} else if ( m_Param[PNT_DRAWMODE] == 1 ) {
glLoadMatrixf ( view_mat );
dat = mBuf[0].data;
glBegin ( GL_POINTS );
for (int n=0; n < NumPoints(); n++) {
p = (Point*) dat;
glColor3f ( RED(p->clr), GRN(p->clr), BLUE(p->clr) );
glVertex3f ( p->pos.x, p->pos.y, p->pos.z );
dat += mBuf[0].stride;
}
glEnd ();
}
}
开发者ID:lakshmiboorgu,项目名称:SPH_Simulation,代码行数:35,代码来源:point_set.cpp
示例18: Desenha
void Desenha (void)
{
int i=0;
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
//glScalef (x_0, y_0, z_0);
//glRotatef (270, 1, 0, 0);
//glRotatef (rotacao, 0, 0, 1);
glRotatef (rotacao, 1, 1, 1);
drawSphere(1.0+x_0,100+v);
//vertices_esfera (1.0);
//desenhar_esfera (100);
//glutWireSphere (1.0,10,10);
//desenhar_esfera (100);
glPopMatrix();
glutSwapBuffers();
}
开发者ID:RickyMartin12,项目名称:CompGraf,代码行数:26,代码来源:esfera.c
示例19: glColor3f
void patrolUnit::OpenGLDraw(const MapProvider *mp, const SimulationInfo *) const
{
GLdouble xx, yy, zz, rad;
Map *map = mp->GetMap();
int posx = x, posy = y;
map->GetOpenGLCoord(posx, posy, xx, yy, zz, rad);
glColor3f(r, g, b);
glBegin(GL_LINE_STRIP);
// glVertex3f(xx, yy+rad/2, zz);
glVertex3f(xx, yy, zz-rad/2);
for (int t = moves.size()-1; t >= 0; t--)
{
posx += ((moves[t]&kE)?1:0) - ((moves[t]&kW)?1:0);
posy += ((moves[t]&kS)?1:0) - ((moves[t]&kN)?1:0);
map->GetOpenGLCoord(posx, posy, xx, yy, zz, rad);
// glVertex3f(xx, yy+rad/2, zz);
glVertex3f(xx, yy, zz-rad/2);
}
glEnd();
map->GetOpenGLCoord(x, y, xx, yy, zz, rad);
glColor3f(r, g, b);
drawSphere(xx, yy, zz, rad);
}
开发者ID:nathansttt,项目名称:hog2,代码行数:26,代码来源:PatrolUnit.cpp
示例20: drawSphere
void OgreBtDebugDrawer::drawSphere(const Ogre::Vector3& p, const double size,
const Ogre::ColourValue& colour) {
if (mDebugDrawingEnabled) {
drawSphere(OgreBulletUtils::convert(p), size,
OgreBulletUtils::convert(colour));
}
}
开发者ID:netzz,项目名称:minemonics,代码行数:7,代码来源:OgreBtDebugDrawer.cpp
注:本文中的drawSphere函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论