本文整理汇总了C++中Cylinder::draw方法的典型用法代码示例。如果您正苦于以下问题:C++ Cylinder::draw方法的具体用法?C++ Cylinder::draw怎么用?C++ Cylinder::draw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cylinder
的用法示例。
在下文中一共展示了Cylinder::draw方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawLimb
void Frog::drawLimb(float * begin, float * length) {
Sphere joint;
Cylinder limb;
float end[3] = {begin[0] + length[0], begin[1] + length[1], begin[2] + length[2]};
float mag = sqrt(length[0]*length[0] + length[1]*length[1] + length[2]*length[2]);
float norm[3] = {length[0]/mag, length[1]/mag, length[2]/mag};
float cross[3] = {norm[2], 0, -1*norm[0]};
float angle = acos(norm[1]) * 180 / 3.14159f;
glColor3f(color[0], color[1], color[2]);
glPushMatrix();
glTranslatef(begin[0], begin[1], begin[2]);
glRotatef(angle, cross[0], cross[1], cross[2]);
glScalef(.1, mag, .1);
limb.draw();
glPopMatrix();
glColor3f(color[0], color[1], color[2]);
glPushMatrix();
glTranslatef(begin[0], begin[1], begin[2]);
glScalef(.1, .1, .1);
joint.draw();
glPopMatrix();
glPushMatrix();
glTranslatef(end[0], end[1], end[2]);
glScalef(.1, .1, .1);
joint.draw();
glPopMatrix();
}
示例2: drawCylinder
// draws solid Cylinder and wire Cylinder together. The wire color is always black
//pre scene camera and an instance of Cylinder class exists
//post Cylinder is drawn
//usage myCylinder.drawCylinder(color);
void drawCylinder(vec4 color)
{
glUniform4fv( model_color, 1,color );
myCylinder.draw();
glUniform4fv( model_color, 1,vec4(0,0,0,1) );
myWireCylinder.draw();
}
示例3:
static void draw (void)
{
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
if(bRendered) glEnable(GL_TEXTURE_2D);
else glDisable(GL_TEXTURE_2D);
if(bWireframe)
{
glLineWidth( 2.0 );
glPolygonMode(GL_FRONT, GL_LINE);
}
else
glPolygonMode(GL_FRONT, GL_FILL);
glRotatef(5, 1,0,0);
camera.transform(sky);
sun.transform();
if(bDrawGrid) draw_axis();
glColor3f(0.9,0.9,0.9);
// Cylinder building
glPushMatrix();
glTranslatef(0, 0, -100);
glRotatef(40, 0, 1, 0);
spLight.transform(); // Update spot light
cylinder.draw();
step1.draw();
step2.draw();
glPopMatrix();
// Right cuboid building
glPushMatrix();
glTranslatef(100, 25, 25);
build_right.draw();
glTranslatef(-75, 0, 150);
glRotatef( 90, 0, 1, 0 );
build_right.draw();
glPopMatrix();
// Front timber building
glPushMatrix();
glTranslatef(20, 15, 0);
build_front.draw();
glPopMatrix();
// Foundations
glPushMatrix();
glTranslatef(0, -15, 0);
foundation.draw();
glTranslatef(-325, 0, 0);
foundation.draw();
glPopMatrix();
// Water
glPushMatrix();
glTranslatef(-160,-10,0);
water.draw();
glPopMatrix();
glPopMatrix();
glutSwapBuffers();
Sleep(1); // Frame limiter
}