How to add vertices to OpenGL C++ triangle_fan -


i need add correct lighting opengl irregular polygon filled using triangle_fan.

glbegin(gl_triangle_fan);  glnormal3f(0.0, 0.0, 1.0); glvertex3f(0.0f, 0.0f,0.0f); glvertex3f(b[0][0],b[0][1], 0); glvertex3f(b[11][0], b[11][1], 0); glvertex3f(b[7][0], b[7][1], 0); glvertex3f(b[10][0], b[10][1], 0); glvertex3f(b[6][0],b[6][1], 0); glvertex3f(b[5][0],b[5][1], 0); glvertex3f(b[4][0],b[4][1], 0); glvertex3f(b[8][0],b[8][1], 0); glvertex3f(b[3][0],b[3][1], 0); glvertex3f(b[9][0],b[9][1], 0); glvertex3f(b[2][0],b[2][1], 0); glvertex3f(b[1][0],b[1][1], 0); glvertex3f(b[0][0],b[0][1], 0);  glend(); 

the problem current polygon not reflect light correctly. vertices, gives light hits x shape. guessing need add vertices polygon. there simple way keep triangle fan add vertices it?

to "correct" results when lighting object, need define appropriate normals. since have 1 normal every vertex, didn't shade correctly.

however, there's no correct way calculate normals model; have define how object should shaded, , add more glnormal calls inform opengl how want shaded.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -