Jump to content
  • Advertisement


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


supplying you own normals

This topic is 6106 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

ok heres the thing........ i want to supply my own normals for a polygon (rather than what gl calculates by clockwise order of vertices or whatever) here is my init code glPolygonMode( GL_BACK, GL_LINE );//so i can see what gl thinks is the front and back here is my draw code glBegin(GL_TRIANGLES); glNormal3f(1.0f,0.0f,0.0f);//this normal is incorrect on purpose to test glColor3f(1.0f,0.0f,0.0f); glVertex3f(vertex[0].i,vertex[0].j,vertex[0].k); glColor3f(0.0f,1.0f,0.0f); glVertex3f(vertex[1].i,vertex[1].j,vertex[1].k); glColor3f(0.0f,0.0f,1.0f); glVertex3f(vertex[2].i,vertex[2].j,vertex[2].k); glEnd(); now...... gl completely ignores my glNormal3f call and computes the normals itself why is this? is there a way around it? thx in advance - Infested Furby

Share this post

Link to post
Share on other sites
I''m not sure I understand what your saying, but I''ll give it a go...

are you thinking that the direction a normal is pointing dictates what side of the polygon is being drawn?? this isn''t true, it''s the order of the verticies once they are on screen.. counter clock wise, or clockwise.

normals are used for lighting and, sometimes, texture mapping, at each vertex. thus you should specify a normal at each vertex (this is something some people don''t realise)...

the normal should, hence it''s name, be perpendiculat to the polygon.... or the average of all nearby polygons if many connect to the save vertex...

GL won''t auto compute normals for you either.

the way lighting works is a comparison to the normal.
if the direction to the light is eactly the same as the direction the normal points, then the light will be it''s brightest... and if the two are at 90 degress or more, then it will be darkest.

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
There are 2 types of normals used in OpenGL:

Face normals: they are geometric normals, that are always perpendicular to the plane of the triangle. They are auto generated by OGL and can''t be supplied manually. They are used for backface culling and twosided lighting.

Vertex normals: they are manually specified per vertex. They don''t need to be geometrically correct (would be impossible), and they are only used for lighting, texgen and register combiner operations. You have to supply them manually, basic OGL won''t generate them.

There is one exception though, where vertex normals are used for backface culling: the Ext_vertex_cull (or similar) extension. I''m not aware of any consumer level 3D card supporting that extension.

- AH

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!