zoukankan      html  css  js  c++  java
  • glColorMaterial

    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).

  • 相关阅读:
    Remove Element
    Binary Tree Inorder Traversal
    Symmetric Tree
    Roman to Integer
    Search Insert Position
    Reverse Integer
    Pascal's Triangle
    Merge Sorted Array
    Same Tree
    Visual Studio Code 做PHP开发
  • 原文地址:https://www.cnblogs.com/zengqh/p/2591733.html
Copyright © 2011-2022 走看看