opengl - how to draw 3d cylinder with flat shading -


I would like to know how to draw the cylinder with flat shading.

We have done so far.

  zero coordinator (intm major, intu ninometer, float height, float radius) {double key phase = height / number major; Double Minority Phase = 2.0 * M_PI / numMinor; Int i, j; For (i = 0; i & lt; numMajor; ++ i) (float z0 = 0.5 * height - i * majorStep; float z1 = z0 - key step; glBegin (GL_TRIANGLE_STRIP); for (j = 0; j & Lt; = numminor; ++ j) {double a = j * small phase; float x = radius * cos (a); float y = radius * sin (a); glyormal 3f (x / radius, y / radius GlTexCoord2f (j / numminor, i / nummajor); GlVertex3f (x, y, z0); GlTexCoord2f (j / numminor, (i + 1) / nummajor; GlVertex3f (x, y, z1);} Glend ();}}   

I understand that I know a general definition, but this general has given me a smooth shadow rather than flat I know how can I flatten it in OpenGL and GLUT?

If you If you want flat cinematography, you just need to specify it.

  glShadeModel (GL_FLAT);    

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -