Browse Source

preparing for merging state and viewerdata

Former-commit-id: a059fb1c24528040542b5c55945351ecff7e8aa2
Daniele Panozzo 7 years ago
parent
commit
48f73ef2e1

+ 14 - 14
include/igl/opengl/State.cpp → include/igl/opengl/MeshGL.cpp

@@ -6,13 +6,13 @@
 // v. 2.0. If a copy of the MPL was not distributed with this file, You can
 // 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/.
 // obtain one at http://mozilla.org/MPL/2.0/.
 
 
-#include "State.h"
+#include "MeshGL.h"
 #include "bind_vertex_attrib_array.h"
 #include "bind_vertex_attrib_array.h"
-#include "../ViewerData.h"
+#include "ViewerData.h"
 #include "create_shader_program.h"
 #include "create_shader_program.h"
 #include "destroy_shader_program.h"
 #include "destroy_shader_program.h"
 
 
-IGL_INLINE void igl::opengl::State::init_buffers()
+IGL_INLINE void igl::opengl::MeshGL::init_buffers()
 {
 {
   // Mesh: Vertex Array Object & Buffer objects
   // Mesh: Vertex Array Object & Buffer objects
   glGenVertexArrays(1, &vao_mesh);
   glGenVertexArrays(1, &vao_mesh);
@@ -43,7 +43,7 @@ IGL_INLINE void igl::opengl::State::init_buffers()
   dirty = ViewerData::DIRTY_ALL;
   dirty = ViewerData::DIRTY_ALL;
 }
 }
 
 
-IGL_INLINE void igl::opengl::State::free_buffers()
+IGL_INLINE void igl::opengl::MeshGL::free_buffers()
 {
 {
   glDeleteVertexArrays(1, &vao_mesh);
   glDeleteVertexArrays(1, &vao_mesh);
   glDeleteVertexArrays(1, &vao_overlay_lines);
   glDeleteVertexArrays(1, &vao_overlay_lines);
@@ -66,8 +66,8 @@ IGL_INLINE void igl::opengl::State::free_buffers()
   glDeleteTextures(1, &vbo_tex);
   glDeleteTextures(1, &vbo_tex);
 }
 }
 
 
-IGL_INLINE void igl::opengl::State::set_data(
-  const igl::ViewerData &data, 
+IGL_INLINE void igl::opengl::MeshGL::set_data(
+  const igl::opengl::ViewerData &data, 
   bool invert_normals)
   bool invert_normals)
 {
 {
   bool per_corner_uv = (data.F_uv.rows() == data.F.rows());
   bool per_corner_uv = (data.F_uv.rows() == data.F.rows());
@@ -294,7 +294,7 @@ IGL_INLINE void igl::opengl::State::set_data(
   }
   }
 }
 }
 
 
-IGL_INLINE void igl::opengl::State::bind_mesh()
+IGL_INLINE void igl::opengl::MeshGL::bind_mesh()
 {
 {
   glBindVertexArray(vao_mesh);
   glBindVertexArray(vao_mesh);
   glUseProgram(shader_mesh);
   glUseProgram(shader_mesh);
@@ -324,7 +324,7 @@ IGL_INLINE void igl::opengl::State::bind_mesh()
   dirty &= ~ViewerData::DIRTY_MESH;
   dirty &= ~ViewerData::DIRTY_MESH;
 }
 }
 
 
-IGL_INLINE void igl::opengl::State::bind_overlay_lines()
+IGL_INLINE void igl::opengl::MeshGL::bind_overlay_lines()
 {
 {
   bool is_dirty = dirty & ViewerData::DIRTY_OVERLAY_LINES;
   bool is_dirty = dirty & ViewerData::DIRTY_OVERLAY_LINES;
 
 
@@ -340,7 +340,7 @@ IGL_INLINE void igl::opengl::State::bind_overlay_lines()
   dirty &= ~ViewerData::DIRTY_OVERLAY_LINES;
   dirty &= ~ViewerData::DIRTY_OVERLAY_LINES;
 }
 }
 
 
-IGL_INLINE void igl::opengl::State::bind_overlay_points()
+IGL_INLINE void igl::opengl::MeshGL::bind_overlay_points()
 {
 {
   bool is_dirty = dirty & ViewerData::DIRTY_OVERLAY_POINTS;
   bool is_dirty = dirty & ViewerData::DIRTY_OVERLAY_POINTS;
 
 
@@ -356,7 +356,7 @@ IGL_INLINE void igl::opengl::State::bind_overlay_points()
   dirty &= ~ViewerData::DIRTY_OVERLAY_POINTS;
   dirty &= ~ViewerData::DIRTY_OVERLAY_POINTS;
 }
 }
 
 
-IGL_INLINE void igl::opengl::State::draw_mesh(bool solid)
+IGL_INLINE void igl::opengl::MeshGL::draw_mesh(bool solid)
 {
 {
   glPolygonMode(GL_FRONT_AND_BACK, solid ? GL_FILL : GL_LINE);
   glPolygonMode(GL_FRONT_AND_BACK, solid ? GL_FILL : GL_LINE);
 
 
@@ -372,17 +372,17 @@ IGL_INLINE void igl::opengl::State::draw_mesh(bool solid)
   glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
   glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
 }
 }
 
 
-IGL_INLINE void igl::opengl::State::draw_overlay_lines()
+IGL_INLINE void igl::opengl::MeshGL::draw_overlay_lines()
 {
 {
   glDrawElements(GL_LINES, lines_F_vbo.rows(), GL_UNSIGNED_INT, 0);
   glDrawElements(GL_LINES, lines_F_vbo.rows(), GL_UNSIGNED_INT, 0);
 }
 }
 
 
-IGL_INLINE void igl::opengl::State::draw_overlay_points()
+IGL_INLINE void igl::opengl::MeshGL::draw_overlay_points()
 {
 {
   glDrawElements(GL_POINTS, points_F_vbo.rows(), GL_UNSIGNED_INT, 0);
   glDrawElements(GL_POINTS, points_F_vbo.rows(), GL_UNSIGNED_INT, 0);
 }
 }
 
 
-IGL_INLINE void igl::opengl::State::init()
+IGL_INLINE void igl::opengl::MeshGL::init()
 {
 {
   if(is_initialized)
   if(is_initialized)
   {
   {
@@ -515,7 +515,7 @@ IGL_INLINE void igl::opengl::State::init()
     shader_overlay_points);
     shader_overlay_points);
 }
 }
 
 
-IGL_INLINE void igl::opengl::State::free()
+IGL_INLINE void igl::opengl::MeshGL::free()
 {
 {
   const auto free = [](GLuint & id)
   const auto free = [](GLuint & id)
   {
   {

+ 6 - 10
include/igl/opengl/State.h → include/igl/opengl/MeshGL.h

@@ -5,26 +5,22 @@
 // This Source Code Form is subject to the terms of the Mozilla Public License
 // 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
 // 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/.
 // obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef IGL_OPENGL_STATE_H
-#define IGL_OPENGL_STATE_H
+#ifndef IGL_OPENGL_MESHGL_H
+#define IGL_OPENGL_MESHGL_H
 
 
 // Coverts mesh data inside a igl::ViewerData class in an OpenGL
 // Coverts mesh data inside a igl::ViewerData class in an OpenGL
 // compatible format The class includes a shader and the opengl calls to plot
 // compatible format The class includes a shader and the opengl calls to plot
 // the data
 // the data
 
 
-// Alec: not sure why this is call "State". It seems this is a drawable mesh
-// equipt with its own shaders and dirty flags. "Mesh" would even be more
-// appropriate.
-
 #include <igl/igl_inline.h>
 #include <igl/igl_inline.h>
-#include "../ViewerData.h"
+#include "ViewerData.h"
 
 
 namespace igl
 namespace igl
 {
 {
 namespace opengl
 namespace opengl
 {
 {
 
 
-class State
+class MeshGL
 {
 {
 public:
 public:
   typedef unsigned int GLuint;
   typedef unsigned int GLuint;
@@ -88,7 +84,7 @@ public:
   IGL_INLINE void init_buffers();
   IGL_INLINE void init_buffers();
 
 
   // Update contents from a 'Data' instance
   // Update contents from a 'Data' instance
-  IGL_INLINE void set_data(const igl::ViewerData &data, bool invert_normals);
+  IGL_INLINE void set_data(const igl::opengl::ViewerData &data, bool invert_normals);
 
 
   // Bind the underlying OpenGL buffer objects for subsequent mesh draw calls
   // Bind the underlying OpenGL buffer objects for subsequent mesh draw calls
   IGL_INLINE void bind_mesh();
   IGL_INLINE void bind_mesh();
@@ -117,7 +113,7 @@ public:
 }
 }
 
 
 #ifndef IGL_STATIC_LIBRARY
 #ifndef IGL_STATIC_LIBRARY
-#  include "State.cpp"
+#  include "MeshGL.cpp"
 #endif
 #endif
 
 
 #endif
 #endif

+ 2 - 2
include/igl/opengl/ViewerCore.cpp

@@ -96,7 +96,7 @@ IGL_INLINE void igl::opengl::ViewerCore::clear_framebuffers()
 
 
 IGL_INLINE void igl::opengl::ViewerCore::draw(
 IGL_INLINE void igl::opengl::ViewerCore::draw(
   ViewerData& data,
   ViewerData& data,
-  State& opengl,
+  MeshGL& opengl,
   bool update_matrices)
   bool update_matrices)
 {
 {
   using namespace std;
   using namespace std;
@@ -289,7 +289,7 @@ IGL_INLINE void igl::opengl::ViewerCore::draw(
 }
 }
 
 
 IGL_INLINE void igl::opengl::ViewerCore::draw_buffer(ViewerData& data,
 IGL_INLINE void igl::opengl::ViewerCore::draw_buffer(ViewerData& data,
-  State& opengl,
+  MeshGL& opengl,
   bool update_matrices,
   bool update_matrices,
   Eigen::Matrix<unsigned char,Eigen::Dynamic,Eigen::Dynamic>& R,
   Eigen::Matrix<unsigned char,Eigen::Dynamic,Eigen::Dynamic>& R,
   Eigen::Matrix<unsigned char,Eigen::Dynamic,Eigen::Dynamic>& G,
   Eigen::Matrix<unsigned char,Eigen::Dynamic,Eigen::Dynamic>& G,

+ 4 - 5
include/igl/opengl/ViewerCore.h

@@ -8,12 +8,11 @@
 #ifndef IGL_OPENGL_VIEWERCORE_H
 #ifndef IGL_OPENGL_VIEWERCORE_H
 #define IGL_OPENGL_VIEWERCORE_H
 #define IGL_OPENGL_VIEWERCORE_H
 
 
-#include <igl/opengl/State.h>
+#include <igl/opengl/MeshGL.h>
 #ifdef IGL_VIEWER_WITH_NANOGUI
 #ifdef IGL_VIEWER_WITH_NANOGUI
 #include <igl/opengl/glfw/TextRenderer.h>
 #include <igl/opengl/glfw/TextRenderer.h>
 #endif
 #endif
-#include <igl/ViewerData.h>
-#include <igl/opengl/State.h>
+#include <igl/opengl/ViewerData.h>
 
 
 #include <igl/igl_inline.h>
 #include <igl/igl_inline.h>
 #include <Eigen/Geometry>
 #include <Eigen/Geometry>
@@ -76,10 +75,10 @@ public:
   // Draw everything
   // Draw everything
   //
   //
   // data cannot be const because it is being set to "clean"
   // data cannot be const because it is being set to "clean"
-  IGL_INLINE void draw(ViewerData& data, State& opengl, bool update_matrices = true);
+  IGL_INLINE void draw(ViewerData& data, MeshGL& opengl, bool update_matrices = true);
   IGL_INLINE void draw_buffer(
   IGL_INLINE void draw_buffer(
     ViewerData& data,
     ViewerData& data,
-    State& opengl,
+    MeshGL& opengl,
     bool update_matrices,
     bool update_matrices,
     Eigen::Matrix<unsigned char,Eigen::Dynamic,Eigen::Dynamic>& R,
     Eigen::Matrix<unsigned char,Eigen::Dynamic,Eigen::Dynamic>& R,
     Eigen::Matrix<unsigned char,Eigen::Dynamic,Eigen::Dynamic>& G,
     Eigen::Matrix<unsigned char,Eigen::Dynamic,Eigen::Dynamic>& G,

+ 24 - 24
include/igl/ViewerData.cpp → include/igl/opengl/ViewerData.cpp

@@ -8,15 +8,15 @@
 
 
 #include "ViewerData.h"
 #include "ViewerData.h"
 
 
-#include "per_face_normals.h"
-#include "material_colors.h"
-#include "parula.h"
-#include "per_vertex_normals.h"
+#include "../per_face_normals.h"
+#include "../material_colors.h"
+#include "../parula.h"
+#include "../per_vertex_normals.h"
 
 
 #include <iostream>
 #include <iostream>
 
 
 
 
-IGL_INLINE igl::ViewerData::ViewerData()
+IGL_INLINE igl::opengl::ViewerData::ViewerData()
 : dirty(DIRTY_ALL),
 : dirty(DIRTY_ALL),
   show_faces(true),
   show_faces(true),
   show_lines(true),
   show_lines(true),
@@ -34,7 +34,7 @@ IGL_INLINE igl::ViewerData::ViewerData()
   clear();
   clear();
 };
 };
 
 
-IGL_INLINE void igl::ViewerData::set_face_based(bool newvalue)
+IGL_INLINE void igl::opengl::ViewerData::set_face_based(bool newvalue)
 {
 {
   if (face_based != newvalue)
   if (face_based != newvalue)
   {
   {
@@ -44,7 +44,7 @@ IGL_INLINE void igl::ViewerData::set_face_based(bool newvalue)
 }
 }
 
 
 // Helpers that draws the most common meshes
 // Helpers that draws the most common meshes
-IGL_INLINE void igl::ViewerData::set_mesh(
+IGL_INLINE void igl::opengl::ViewerData::set_mesh(
     const Eigen::MatrixXd& _V, const Eigen::MatrixXi& _F)
     const Eigen::MatrixXd& _V, const Eigen::MatrixXi& _F)
 {
 {
   using namespace std;
   using namespace std;
@@ -86,14 +86,14 @@ IGL_INLINE void igl::ViewerData::set_mesh(
   dirty |= DIRTY_FACE | DIRTY_POSITION;
   dirty |= DIRTY_FACE | DIRTY_POSITION;
 }
 }
 
 
-IGL_INLINE void igl::ViewerData::set_vertices(const Eigen::MatrixXd& _V)
+IGL_INLINE void igl::opengl::ViewerData::set_vertices(const Eigen::MatrixXd& _V)
 {
 {
   V = _V;
   V = _V;
   assert(F.size() == 0 || F.maxCoeff() < V.rows());
   assert(F.size() == 0 || F.maxCoeff() < V.rows());
   dirty |= DIRTY_POSITION;
   dirty |= DIRTY_POSITION;
 }
 }
 
 
-IGL_INLINE void igl::ViewerData::set_normals(const Eigen::MatrixXd& N)
+IGL_INLINE void igl::opengl::ViewerData::set_normals(const Eigen::MatrixXd& N)
 {
 {
   using namespace std;
   using namespace std;
   if (N.rows() == V.rows())
   if (N.rows() == V.rows())
@@ -111,7 +111,7 @@ IGL_INLINE void igl::ViewerData::set_normals(const Eigen::MatrixXd& N)
   dirty |= DIRTY_NORMAL;
   dirty |= DIRTY_NORMAL;
 }
 }
 
 
-IGL_INLINE void igl::ViewerData::set_colors(const Eigen::MatrixXd &C)
+IGL_INLINE void igl::opengl::ViewerData::set_colors(const Eigen::MatrixXd &C)
 {
 {
   using namespace std;
   using namespace std;
   using namespace Eigen;
   using namespace Eigen;
@@ -179,7 +179,7 @@ IGL_INLINE void igl::ViewerData::set_colors(const Eigen::MatrixXd &C)
 
 
 }
 }
 
 
-IGL_INLINE void igl::ViewerData::set_uv(const Eigen::MatrixXd& UV)
+IGL_INLINE void igl::opengl::ViewerData::set_uv(const Eigen::MatrixXd& UV)
 {
 {
   using namespace std;
   using namespace std;
   if (UV.rows() == V.rows())
   if (UV.rows() == V.rows())
@@ -192,7 +192,7 @@ IGL_INLINE void igl::ViewerData::set_uv(const Eigen::MatrixXd& UV)
   dirty |= DIRTY_UV;
   dirty |= DIRTY_UV;
 }
 }
 
 
-IGL_INLINE void igl::ViewerData::set_uv(const Eigen::MatrixXd& UV_V, const Eigen::MatrixXi& UV_F)
+IGL_INLINE void igl::opengl::ViewerData::set_uv(const Eigen::MatrixXd& UV_V, const Eigen::MatrixXi& UV_F)
 {
 {
   set_face_based(true);
   set_face_based(true);
   V_uv = UV_V.block(0,0,UV_V.rows(),2);
   V_uv = UV_V.block(0,0,UV_V.rows(),2);
@@ -201,7 +201,7 @@ IGL_INLINE void igl::ViewerData::set_uv(const Eigen::MatrixXd& UV_V, const Eigen
 }
 }
 
 
 
 
-IGL_INLINE void igl::ViewerData::set_texture(
+IGL_INLINE void igl::opengl::ViewerData::set_texture(
   const Eigen::Matrix<unsigned char,Eigen::Dynamic,Eigen::Dynamic>& R,
   const Eigen::Matrix<unsigned char,Eigen::Dynamic,Eigen::Dynamic>& R,
   const Eigen::Matrix<unsigned char,Eigen::Dynamic,Eigen::Dynamic>& G,
   const Eigen::Matrix<unsigned char,Eigen::Dynamic,Eigen::Dynamic>& G,
   const Eigen::Matrix<unsigned char,Eigen::Dynamic,Eigen::Dynamic>& B)
   const Eigen::Matrix<unsigned char,Eigen::Dynamic,Eigen::Dynamic>& B)
@@ -213,7 +213,7 @@ IGL_INLINE void igl::ViewerData::set_texture(
   dirty |= DIRTY_TEXTURE;
   dirty |= DIRTY_TEXTURE;
 }
 }
 
 
-IGL_INLINE void igl::ViewerData::set_texture(
+IGL_INLINE void igl::opengl::ViewerData::set_texture(
   const Eigen::Matrix<unsigned char,Eigen::Dynamic,Eigen::Dynamic>& R,
   const Eigen::Matrix<unsigned char,Eigen::Dynamic,Eigen::Dynamic>& R,
   const Eigen::Matrix<unsigned char,Eigen::Dynamic,Eigen::Dynamic>& G,
   const Eigen::Matrix<unsigned char,Eigen::Dynamic,Eigen::Dynamic>& G,
   const Eigen::Matrix<unsigned char,Eigen::Dynamic,Eigen::Dynamic>& B,
   const Eigen::Matrix<unsigned char,Eigen::Dynamic,Eigen::Dynamic>& B,
@@ -226,7 +226,7 @@ IGL_INLINE void igl::ViewerData::set_texture(
   dirty |= DIRTY_TEXTURE;
   dirty |= DIRTY_TEXTURE;
 }
 }
 
 
-IGL_INLINE void igl::ViewerData::set_points(
+IGL_INLINE void igl::opengl::ViewerData::set_points(
   const Eigen::MatrixXd& P,
   const Eigen::MatrixXd& P,
   const Eigen::MatrixXd& C)
   const Eigen::MatrixXd& C)
 {
 {
@@ -235,7 +235,7 @@ IGL_INLINE void igl::ViewerData::set_points(
   add_points(P,C);
   add_points(P,C);
 }
 }
 
 
-IGL_INLINE void igl::ViewerData::add_points(const Eigen::MatrixXd& P,  const Eigen::MatrixXd& C)
+IGL_INLINE void igl::opengl::ViewerData::add_points(const Eigen::MatrixXd& P,  const Eigen::MatrixXd& C)
 {
 {
   Eigen::MatrixXd P_temp;
   Eigen::MatrixXd P_temp;
 
 
@@ -256,7 +256,7 @@ IGL_INLINE void igl::ViewerData::add_points(const Eigen::MatrixXd& P,  const Eig
   dirty |= DIRTY_OVERLAY_POINTS;
   dirty |= DIRTY_OVERLAY_POINTS;
 }
 }
 
 
-IGL_INLINE void igl::ViewerData::set_edges(
+IGL_INLINE void igl::opengl::ViewerData::set_edges(
   const Eigen::MatrixXd& P,
   const Eigen::MatrixXd& P,
   const Eigen::MatrixXi& E,
   const Eigen::MatrixXi& E,
   const Eigen::MatrixXd& C)
   const Eigen::MatrixXd& C)
@@ -279,7 +279,7 @@ IGL_INLINE void igl::ViewerData::set_edges(
   dirty |= DIRTY_OVERLAY_LINES;
   dirty |= DIRTY_OVERLAY_LINES;
 }
 }
 
 
-IGL_INLINE void igl::ViewerData::add_edges(const Eigen::MatrixXd& P1, const Eigen::MatrixXd& P2, const Eigen::MatrixXd& C)
+IGL_INLINE void igl::opengl::ViewerData::add_edges(const Eigen::MatrixXd& P1, const Eigen::MatrixXd& P2, const Eigen::MatrixXd& C)
 {
 {
   Eigen::MatrixXd P1_temp,P2_temp;
   Eigen::MatrixXd P1_temp,P2_temp;
 
 
@@ -305,7 +305,7 @@ IGL_INLINE void igl::ViewerData::add_edges(const Eigen::MatrixXd& P1, const Eige
   dirty |= DIRTY_OVERLAY_LINES;
   dirty |= DIRTY_OVERLAY_LINES;
 }
 }
 
 
-IGL_INLINE void igl::ViewerData::add_label(const Eigen::VectorXd& P,  const std::string& str)
+IGL_INLINE void igl::opengl::ViewerData::add_label(const Eigen::VectorXd& P,  const std::string& str)
 {
 {
   Eigen::RowVectorXd P_temp;
   Eigen::RowVectorXd P_temp;
 
 
@@ -324,7 +324,7 @@ IGL_INLINE void igl::ViewerData::add_label(const Eigen::VectorXd& P,  const std:
   labels_strings.push_back(str);
   labels_strings.push_back(str);
 }
 }
 
 
-IGL_INLINE void igl::ViewerData::clear()
+IGL_INLINE void igl::opengl::ViewerData::clear()
 {
 {
   V                       = Eigen::MatrixXd (0,3);
   V                       = Eigen::MatrixXd (0,3);
   F                       = Eigen::MatrixXi (0,3);
   F                       = Eigen::MatrixXi (0,3);
@@ -351,14 +351,14 @@ IGL_INLINE void igl::ViewerData::clear()
   face_based = false;
   face_based = false;
 }
 }
 
 
-IGL_INLINE void igl::ViewerData::compute_normals()
+IGL_INLINE void igl::opengl::ViewerData::compute_normals()
 {
 {
   igl::per_face_normals(V, F, F_normals);
   igl::per_face_normals(V, F, F_normals);
   igl::per_vertex_normals(V, F, F_normals, V_normals);
   igl::per_vertex_normals(V, F, F_normals, V_normals);
   dirty |= DIRTY_NORMAL;
   dirty |= DIRTY_NORMAL;
 }
 }
 
 
-IGL_INLINE void igl::ViewerData::uniform_colors(
+IGL_INLINE void igl::opengl::ViewerData::uniform_colors(
   const Eigen::Vector3d& ambient, 
   const Eigen::Vector3d& ambient, 
   const Eigen::Vector3d& diffuse, 
   const Eigen::Vector3d& diffuse, 
   const Eigen::Vector3d& specular)
   const Eigen::Vector3d& specular)
@@ -374,7 +374,7 @@ IGL_INLINE void igl::ViewerData::uniform_colors(
   uniform_colors(ambient4,diffuse4,specular4);
   uniform_colors(ambient4,diffuse4,specular4);
 }
 }
 
 
-IGL_INLINE void igl::ViewerData::uniform_colors(
+IGL_INLINE void igl::opengl::ViewerData::uniform_colors(
   const Eigen::Vector4d& ambient, 
   const Eigen::Vector4d& ambient, 
   const Eigen::Vector4d& diffuse, 
   const Eigen::Vector4d& diffuse, 
   const Eigen::Vector4d& specular)
   const Eigen::Vector4d& specular)
@@ -403,7 +403,7 @@ IGL_INLINE void igl::ViewerData::uniform_colors(
   dirty |= DIRTY_SPECULAR | DIRTY_DIFFUSE | DIRTY_AMBIENT;
   dirty |= DIRTY_SPECULAR | DIRTY_DIFFUSE | DIRTY_AMBIENT;
 }
 }
 
 
-IGL_INLINE void igl::ViewerData::grid_texture()
+IGL_INLINE void igl::opengl::ViewerData::grid_texture()
 {
 {
   // Don't do anything for an empty mesh
   // Don't do anything for an empty mesh
   if(V.rows() == 0)
   if(V.rows() == 0)

+ 4 - 0
include/igl/ViewerData.h → include/igl/opengl/ViewerData.h

@@ -20,6 +20,9 @@ namespace igl
 {
 {
 
 
 // TODO: write documentation
 // TODO: write documentation
+namespace opengl
+{
+
 
 
 class ViewerData
 class ViewerData
 {
 {
@@ -203,6 +206,7 @@ public:
   float shininess;
   float shininess;
 };
 };
 
 
+}
 }
 }
 
 
 #ifdef ENABLE_SERIALIZATION
 #ifdef ENABLE_SERIALIZATION

+ 1 - 1
include/igl/opengl/glfw/Viewer.cpp

@@ -1124,7 +1124,7 @@ namespace glfw
     return true;
     return true;
   }
   }
 
 
-  IGL_INLINE State& Viewer::selected_opengl_state()
+  IGL_INLINE MeshGL& Viewer::selected_opengl_state()
   {
   {
     assert(!opengl_state_list.empty() && "opengl_state_list should never be empty");
     assert(!opengl_state_list.empty() && "opengl_state_list should never be empty");
     assert(opengl_state_list.size() == data_list.size());
     assert(opengl_state_list.size() == data_list.size());

+ 4 - 4
include/igl/opengl/glfw/Viewer.h

@@ -14,9 +14,9 @@
 
 
 
 
 #include "../../igl_inline.h"
 #include "../../igl_inline.h"
-#include "../State.h"
+#include "../MeshGL.h"
 #include "../ViewerCore.h"
 #include "../ViewerCore.h"
-#include "../../ViewerData.h"
+#include "../ViewerData.h"
 #include "ViewerPlugin.h"
 #include "ViewerPlugin.h"
 
 
 #include <Eigen/Core>
 #include <Eigen/Core>
@@ -85,7 +85,7 @@ namespace glfw
     IGL_INLINE void open_dialog_save_mesh();
     IGL_INLINE void open_dialog_save_mesh();
     IGL_INLINE ViewerData& data();
     IGL_INLINE ViewerData& data();
     //IGL_INLINE const ViewerData& const_data() const;
     //IGL_INLINE const ViewerData& const_data() const;
-    IGL_INLINE State& selected_opengl_state();
+    IGL_INLINE MeshGL& selected_opengl_state();
     // Append a new "slot" for a mesh (i.e., create empty entires at the end of
     // Append a new "slot" for a mesh (i.e., create empty entires at the end of
     // the data_list and opengl_state_list.
     // the data_list and opengl_state_list.
     //
     //
@@ -118,7 +118,7 @@ namespace glfw
     // Stores all the data that should be visualized
     // Stores all the data that should be visualized
     std::vector<ViewerData> data_list;
     std::vector<ViewerData> data_list;
     // Stores the vbos indices and opengl related settings
     // Stores the vbos indices and opengl related settings
-    std::vector<State> opengl_state_list;
+    std::vector<MeshGL> opengl_state_list;
   public:
   public:
     size_t selected_data_index;
     size_t selected_data_index;
     GLFWwindow* window;
     GLFWwindow* window;