Go to the documentation of this file.00001 #ifndef OPENTISSUE_UTILITY_GL_GL_MATERIAL_H
00002 #define OPENTISSUE_UTILITY_GL_GL_MATERIAL_H
00003
00004
00005
00006
00007
00008
00009
00010 #include <OpenTissue/configuration.h>
00011
00012 #include <OpenTissue/utility/gl/gl.h>
00013 #include <OpenTissue/utility/utility_material.h>
00014
00015 namespace OpenTissue
00016 {
00017
00018 namespace gl
00019 {
00020
00025 class Material : public OpenTissue::utility::Material
00026 {
00027 public:
00028
00029 void use()
00030 {
00031 if ( glIsEnabled( GL_COLOR_MATERIAL ) || !glIsEnabled( GL_LIGHTING ) )
00032 {
00033 glColor4f( m_diffuse[ 0 ], m_diffuse[ 1 ], m_diffuse[ 2 ], m_diffuse[ 3 ] );
00034 }
00035 else
00036 {
00037 glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT, m_ambient );
00038 glMaterialfv( GL_FRONT_AND_BACK, GL_DIFFUSE, m_diffuse );
00039 glMaterialfv( GL_FRONT_AND_BACK, GL_SPECULAR, m_specular );
00040 glMaterialfv( GL_FRONT_AND_BACK, GL_SHININESS, &m_shininess );
00041 }
00042 }
00043
00044 };
00045
00046 }
00047
00048 }
00049
00050
00051 #endif