VIZ++ Class: OpenGLColorMaterial

 VIZ++ Class Library  VIZ++ Samples  VIZ++ ClassTree 

Source code

/*
 * OpenGLColorMaterial.h 
 * Copyright (c) 2015 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED. 
 */


#pragma once

#include <viz++/opengl/OpenGLObject.h>

namespace VIZ {

class OpenGLColorMaterial :public OpenGLObject {
private:
  GLenum face;
  GLenum mode;
public:
  OpenGLColorMaterial(GLenum face, GLenum mode)
  :face(face),
   mode(mode)
  {
    glEnable(GL_COLOR_MATERIAL);

    //The parameter face will take CL_FRONT, CL_BACK, CL_FRONT_AND_BACK 
   
    //The parameter mode will take GL_EMISSION, GL_AMBIENT, GL_DIFFUSE, 
    //GL_SPECULAR, and GL_AMBIENT_AND_DIFFUSE. 
    // The initial value is GL_AMBIENT_AND_DIFFUSE. 

    glColorMaterial(face, mode);
  }

  ~OpenGLColorMaterial()
  {
    glDisable(GL_COLOR_MATERIAL);
  }

};

}

  

Last modified: 10 Feb 2017

Copyright (c) 2009-2017 Antillia.com ALL RIGHTS RESERVED.