PDA

View Full Version : Wht the cylinder's surface is not filled?



Qiaowen
04-14-2012, 12:25 AM
Hi.
I want wo draw a column, a solid column, not a wired column. Here is my code:


void DrawPillar(GLdouble radius, GLdouble length)
{
GLUquadricObj *pObj; // Quadric Object

pObj = gluNewQuadric();
gluQuadricDrawStyle(pObj, GLU_FILL);
gluQuadricNormals(pObj, GLU_SMOOTH);
//gluQuadricOrientation(pObj, GLU_OUTSIDE);
//gluQuadricTexture(pObj, GLU_FALSE);

gluCylinder( pObj, radius, radius, length, 20, 20 );
glPushMatrix();
gluDisk( pObj, 0, radius, 10, 10 );
glTranslatef( 0.0f, 0.0f, length );
gluDisk( pObj, 0, radius, 10, 10 );
glPopMatrix();
}

But the surface is still outlined,I get a wired column. Is there any setting to be met before I call my function?

tonyo_au
04-14-2012, 03:21 AM
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE) - wireframe
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL) - fill

for more details
http://www.opengl.org/sdk/docs/man/xhtml/glPolygonMode.xml