glColorMaterial
2012-07-14 19:56
218 查看
When you''re using lighting, OpenGL needs material properties to determine what color of light is reflected from a surface. You can specify these properties for ambient, diffuse, and specular light with glMaterial*, or you can let OpenGL create them for you. If you pass GL_COLOR_MATERIALS to glEnable(), OpenGL will automatically set material properties based on the current color ( glColor*() ). Using glColorMaterial is like a compromise between the two. If you use glColorMaterial, you can still pass values to glMaterial*, but it will disregard the value specified in glColorMaterial. For instance...
glEnable(GL_COLOR_MATERIAL); // Must be called to use glColorMaterial()
glColorMaterial(GL_FRONT, GL_DIFFUSE);
tells OpenGL to create material properties for diffuse light on the front of objects using the current color. All other material properties still need to be specified with glMaterial*.
There''s a good explanation in the Red Book, in the lighting chapter (chapter 5).
glEnable(GL_COLOR_MATERIAL); // Must be called to use glColorMaterial()
glColorMaterial(GL_FRONT, GL_DIFFUSE);
tells OpenGL to create material properties for diffuse light on the front of objects using the current color. All other material properties still need to be specified with glMaterial*.
There''s a good explanation in the Red Book, in the lighting chapter (chapter 5).
相关文章推荐
- glDisable(GL_COLOR_MATERIAL)
- glColorMaterial
- OpenGL使用glColorMaterial设置材质
- OpenGL使用glColorMaterial设置材质
- 关于opengl中颜色表函数glcolortable出现异常的问题(opengl红宝书8-7程序)解决方法
- android中使用material design的问题-Cannot resolve symbol: @color:material_blue_500
- glMaterialfv()
- Unity3D Shader官方教程翻译(六)----Shader语法:Pass的Color, Material, Lighting
- GL_AMBIENT、GL_DIFFUSE、GL_SPECULAR,GL_SHININESS,GL_EMISSION,GL_COLOR_INDEXES的区别
- Unity3d Shader(三) Pass(Color, Material, Lighting )
- OpenGL与vs编程——error C2440: “glMaterialfv”: 无法从“GLfloat”转换为“const GLfloat *”
- Unity3D Shader官方教程翻译(六)----Shader语法:Pass的Color, Material, Lighting
- 【资源】Material Design Color xml
- Unity3d Shader开发(三)Pass(Color, Material, Lighting )
- GL_AMBIENT、GL_DIFFUSE、GL_SPECULAR,GL_SHININESS,GL_EMISSION,GL_COLOR_INDEXES的区别
- GL_AMBIENT、GL_DIFFUSE、GL_SPECULAR,GL_SHININESS,GL_EMISSION,GL_COLOR_INDEXES的区别
- 简述unity中material.color及Color.Lerp线性插值的用法
- GL_AMBIENT、GL_DIFFUSE、GL_SPECULAR,GL_SHININESS,GL_EMISSION,GL_COLOR_INDEXES的区别
- 《高效学习OpenGL》 之 颜色表 glColorTable(),glColorTableParameter(),glCopyColorTable()
- 《高效学习OpenGL》 之 在纹理之后应用辅助颜色 glSecondaryColor()