Jump to content
  • Advertisement
Sign in to follow this  
yakovm

OpenGL normals directions

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

I have a mesh with defined normals for each its surfaces. I want to know if there is some way(preferably OpenGL function) to know if the normals directions are inside or outside for each surface

Share this post


Link to post
Share on other sites
Advertisement
It's difficult to say which side of the normal is the inside or the outside depending on your model. I would suggest you create a plane based on the vertices data and check it with your defined normals to see if its above or below the plane.

Below is a function off my library. Not sure if it helps.

int EnginePlane::classifypoint(EngineVector point)
{
float p=this->normal*(point-(this->point*2))+this->distance;

if(p>0.0f)
{
return PLANE_FRONT;
}
else if(p<0.0f)
{
return PLANE_BACK;
}
else
return PLANE_COINCIDE;
}

:)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!