geometry.cpp
Go to the documentation of this file.
00001 
00004 /*****************************************************************************
00005  ** Includes
00006  *****************************************************************************/
00007 
00008 #include "../../include/qglv/gl/headers.hpp"
00009 #include "../../include/qglv/primitives/geometry.hpp"
00010 
00011 /*****************************************************************************
00012  ** Namespaces
00013  *****************************************************************************/
00014 
00015 namespace qglv {
00016 
00017 /*****************************************************************************
00018  ** Implementation
00019  *****************************************************************************/
00020 
00021 void line(const Eigen::Vector3f & p1, const Eigen::Vector3f & p2) {
00022   glBegin(GL_LINES);
00023   glVertex3f(static_cast<float>(p1[0]), static_cast<float>(p1[1]), static_cast<float>(p1[2]));
00024   glVertex3f(static_cast<float>(p2[0]), static_cast<float>(p2[1]), static_cast<float>(p2[2]));
00025   glEnd();
00026 }
00027 
00028 void point(const Eigen::Vector3f & p, const float size) {
00029   glEnable(GL_POINT_SMOOTH);
00030 
00031   glPointSize(size);
00032   glBegin(GL_POINTS);
00033   glVertex3f(p.x(), p.y(), p.z());
00034   glEnd();
00035 
00036   glDisable(GL_POINT_SMOOTH);
00037 }
00038 
00039 void points(const std::vector<Eigen::Vector3f, Eigen::aligned_allocator<Eigen::Vector3f> > & p, const float size) {
00040   glEnable(GL_POINT_SMOOTH);
00041 
00042   glPointSize(size);
00043 
00044   for (int i(0); i < p.size(); i++)
00045   {
00046     glBegin(GL_POINTS);
00047     glVertex3f(p[i].x(), p[i].y(), p[i].z());
00048     glEnd();
00049   }
00050 
00051   glDisable(GL_POINT_SMOOTH);
00052 }
00053 
00054 void vertex(const Eigen::Vector3f& p)
00055 {
00056   glVertex3f(p.x(), p.y(), p.z());
00057 }
00058 
00059 void square(const float &width, const float& height) {
00060   glBegin(GL_QUADS); // Start drawing a quad primitive
00061   glVertex3f(0.0f, 0.0f, 0.0f); // The bottom left corner
00062   glVertex3f(0.0f, height, 0.0f); // The top left corner
00063   glVertex3f(width, height, 0.0f); // The top right corner
00064   glVertex3f(width, 0.0, 0.0f); // The bottom right corner
00065   glEnd();
00066 }
00067 
00068 /*****************************************************************************
00069  ** Trailers
00070  *****************************************************************************/
00071 
00072 } // namespace qglv


qglv_opengl
Author(s): Daniel Stonier
autogenerated on Sat Jun 18 2016 08:19:28