本文在第11篇文章的基础上,为其加入显示各种二次曲面的代码;
Quadrics
Every quadric has a few settings associated with it. We have to create a quadric first and then customize its settings to render the shape we want. The gluNewQuadric function creates a state variable that describes the current drawing style, orientation, lighting mode, texturing mode and the callback functions. Once we use this function to create a new quadric, we can customize the drawing of shapes by changing its state using functions such as
gluQuadricDrawStyle - which selects the type of OpenGL drawing primitives that are used to drw the shape.
gluQuadricOrientation - which controls the direction of the lighting normals.
gluQuadricNormals - which controls the generation of lighting normals.
gluQuadricTexture - which generates texture coordinates automatically for the quadric.
1,在CCY457OpenGLView类中加入下列变量,用来表示二次曲面类型:
//Quadric
GLuint m_Quadric;