• Advertisement

Archived

This topic is now archived and is closed to further replies.

Normals problem with Vertex Array

This topic is 5986 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

It seems that my codes doesn''t look at the Normal array for some reason. When I run the code, on face looks bright the other looks dark, though it has the same Normal... What am I doing wrong? (for now I use flat shading) Here is the code : double Varray[] = { -9.1862001419067383,0.,-14.746000289916992, -9.1862001419067383,0.,5.6476001739501953, -9.1862001419067383,20.819299697875977,5.6476001739501953, -9.1862001419067383,20.819299697875977,5.6476001739501953, -9.1862001419067383,20.819299697875977,-14.746000289916992, -9.1862001419067383,0.,-14.746000289916992 }; double Narray[] = { -1.0,0.0,0.0, -1.0,0.0,0.0 }; glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_NORMAL_ARRAY); glNormalPointer( GL_DOUBLE, 0, Narray); glVertexPointer( 3, GL_DOUBLE, 0, Varray); glDrawArrays(GL_TRIANGLES, 0, 6);

Share this post


Link to post
Share on other sites
Advertisement
u have 6 vertices thus u must supply 6 normals as well.

double Narray[] = {
-1.0,0.0,0.0,
-1.0,0.0,0.0,
-1.0,0.0,0.0,
-1.0,0.0,0.0,
-1.0,0.0,0.0.
-1.0,0.0,0.0 };

Share this post


Link to post
Share on other sites

  • Advertisement