Gl Graph
Gl Graph Source of globjectdata.h
#ifndef GL_OBJECTDATA_H #define GL_OBJECTDATA_H #define GL_GLEXT_PROTOTYPES #include <GL/gl.h> #include <GL/glext.h> #include <GL/glx.h> #include <GL/glxext.h> #include <GL/glut.h> #include <unordered_map> #include "glversion.h" #include "glprimitive.h" class GlObjectData { protected: GlVersion * glVersion; GLuint vao; GLuint vbo; GLenum dataKind; int bufferDataSize; int normalDataSize; int colorDataSize; int vectexDataSize; bool isNormalDataChanged; bool isColorDataChanged; bool isVectexDataChanged; std::vector<float> normaldata; std::vector<float> colordata; std::vector<float> vertexdata; std::vector<int> indexdata; std::unordered_map<std::string, std::string> * args; bool isVaoForced ; bool isVboForced ; bool isVaForced; void initGl3_3_0(); void initGl2(); void initGlOld(); void updateData(); void updateDataGl3_3_0(); void updateDataGl2(); void updateDataGlOld(); void internalDraw(); void printGlError(const char * msg); void reset(); public: GlObjectData(); GlObjectData(GLenum dataKind,std::unordered_map<std::string, std::string> * args); void init(GlVersion * glVersion); void draw(); void addNormalData(float val); void addColorData(float val); void addVertexData(float val); void addNormalData(float val1,float val2,float val3); void addColorData(float val1,float val2,float val3); void addVertexData(float val1,float val2,float val3); void addNormalData(Vec3f &vec); void addColorData(Vec3f &vec); void addVertexData(Vec3f &vec); void setNormalData(int index,Vec3f &vec); void setColorData(int index,Vec3f &vec); void setVertexData(int index,Vec3f &vec); unsigned int getNbVertex() const ; unsigned int getNbColorVertex() const; unsigned int getNbNormalVertex() const; }; class GlLineData : public GlObjectData { public: GlLineData() {}; GlLineData(std::unordered_map<std::string, std::string> * args); void addLineNormalData(GlNormalLine &normalLine); void addLineColorData (GlColorLine &colorLine); void addLineVertexData(GlLine &line); }; class GlLineStripData : public GlObjectData { public: GlLineStripData() {}; GlLineStripData(std::unordered_map<std::string, std::string> * args); void addLineNormalData(Vec3f &vec1); void addLineColorData (Vec3f &vec1); void addLineVertexData(Vec3f &vec1); }; class GlTriangleData : public GlObjectData { public: GlTriangleData() {}; GlTriangleData(std::unordered_map<std::string, std::string> * args); void addTriangleNormalData(GlNormalTriangle &normalTriangle); void addTriangleColorData (GlColorTriangle &colorTriangle); void addTriangleVertexData(GlTriangle &triangle); }; class GlQuadData : public GlObjectData { public: GlQuadData() {}; GlQuadData(std::unordered_map<std::string, std::string> * args); void addQuadNormalData(GlNormalQuad &normalQuad); void addQuadColorData (GlColorQuad &colorQuad); void addQuadVertexData(GlQuad &quad); void setQuadNormalData(int index,GlNormalQuad &normalQuad); void setQuadColorData (int index,GlColorQuad &colorQuad); void setQuadVertexData(int index,GlQuad &quad); }; #endif