垂直於平面的法向量(perpendicular.ppt

上传人:s****8 文档编号:67201389 上传时间:2022-12-24 格式:PPT 页数:7 大小:668KB
返回 下载 相关 举报
垂直於平面的法向量(perpendicular.ppt_第1页
第1页 / 共7页
垂直於平面的法向量(perpendicular.ppt_第2页
第2页 / 共7页
点击查看更多>>
资源描述

《垂直於平面的法向量(perpendicular.ppt》由会员分享,可在线阅读,更多相关《垂直於平面的法向量(perpendicular.ppt(7页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。

1、NormalsSpecifying the normalvoid glNormal3d(GLdouble nx,GLdouble ny,GLdouble nz);When using lighting effects,normals must be defined for each polygon or for each vertex.OpenGL does not calculate a normal by itself.垂直於平面的法向量(perpendicular to a plane)單位法向量(normalized normal vector)Normal VectorWhat is

2、 cross product(外積)Normalized Normal VectorV=(Vx,Vy,Vz),Length of V=|V|=(Vx2+Vy2+Vz2)1/2Normalized Normal Vector V=(Vx,Vy,Vz)/|V|=(Vx/|V|,Vy/|V|,Vz/|V|)Shading ModelsChoose the shading modelvoid glShadeModel(GLenum mode);mode may beGL_FLATGL_SMOOTH(the same as the Gouraud shading model)OpenGL does no

3、t support the Phong shading model.Material PropertiesAn object has a certain reflective propertiesWhen using lighting,each model part has its own material properties,which also define its color.glMaterialfv(GLenum face,GLenum pname,const GLfloat*params)Face must be one of GL_FRONT,GL_BACK,or GL_FRON

4、T_AND_BACK.pname can be GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_SHININESS etc.params change accordingly.ColorsIn case you want to specify colors per face or per vertex,you mustEnable color tracking.glEnable(GL_COLOR_MATRERIAL);Set material properties to follow glColor values.glColorMaterial(GLenum face

5、,GLenum mode);Specify the color before defining its corresponding vertex.glColor3d(GLdouble red,GLdouble green,GLdouble blue);glColor3ub(GLubyte red,GLubyte green,GLubyte blue);Adding Light to a SceneEnabling lightingglEnable(GL_LIGHT);OpenGL supports up to GL_MAX_LIGHTS lights simultaneouslyQuery with glGetIntegerv(GL_MAX_LIGHTS)Set the light propertiesvoid glLightfv(GLenum light,GLenum pname,const GLfloat*params);pname can be GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_POSITION etc.params change accordingly.Enable the specific lightglEnable(GL_LIGHTi);i is between 0 and GL_MAX_LIGHTS-1

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 生活休闲 > 生活常识

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号© 2020-2023 www.taowenge.com 淘文阁