// This file is part of libigl, a simple c++ geometry processing library. // // Copyright (C) 2013 Alec Jacobson // // This Source Code Form is subject to the terms of the Mozilla Public License // v. 2.0. If a copy of the MPL was not distributed with this file, You can // obtain one at http://mozilla.org/MPL/2.0/. #include "draw_floor.h" #include "gl.h" IGL_INLINE void igl::opengl2::draw_floor(const float * colorA, const float * colorB, const int GridSizeX, const int GridSizeY) { const float SizeX = 0.5f*100./(double)GridSizeX; const float SizeY = 0.5f*100./(double)GridSizeY; // old settings int old_lighting=0,old_color_material=0; glGetIntegerv(GL_LIGHTING,&old_lighting); glGetIntegerv(GL_COLOR_MATERIAL,&old_color_material); glDisable(GL_LIGHTING); glColorMaterial( GL_FRONT, GL_EMISSION); glEnable(GL_COLOR_MATERIAL); glColorMaterial( GL_FRONT, GL_AMBIENT_AND_DIFFUSE); // Set material const float black[] = {0.,0.,0.,1.}; glMaterialfv(GL_FRONT, GL_AMBIENT, black); glMaterialfv(GL_FRONT, GL_DIFFUSE, black); glMaterialfv(GL_FRONT, GL_SPECULAR, black); glMaterialfv(GL_FRONT, GL_EMISSION, black); glMaterialf(GL_FRONT, GL_SHININESS,0); const bool use_lighting = false; if(use_lighting) { glEnable(GL_LIGHTING); }else { glDisable(GL_LIGHTING); } glBegin(GL_QUADS); glNormal3f(0,1,0); for (int x =-GridSizeX/2;x