00001
00002
00003
00004
00005
00006
00007 #ifndef BALL_VIEW_RENDERING_VERTEXBUFFER_H
00008 #define BALL_VIEW_RENDERING_VERTEXBUFFER_H
00009
00010 #ifndef BALL_COMMON_H
00011 # include <BALL/common.h>
00012 #endif
00013
00014 #ifndef BALL_VIEW_KERNEL_COMMON_H
00015 # include <BALL/VIEW/KERNEL/common.h>
00016 #endif
00017
00018 #ifndef BALL_VIEW_DATATYPE_COLORRGBA_H
00019 # include <BALL/VIEW/DATATYPE/colorRGBA.h>
00020 #endif
00021
00022 namespace BALL
00023 {
00024 namespace VIEW
00025 {
00026 class Mesh;
00027 class GLRenderer;
00028
00040 class BALL_VIEW_EXPORT MeshBuffer
00041 {
00042 public:
00043
00044 BALL_CREATE(MeshBuffer)
00045
00046 typedef GLuint Buffer[4];
00047
00049 MeshBuffer();
00050
00052 MeshBuffer(const MeshBuffer& mesh_buffer);
00053
00055 virtual ~MeshBuffer();
00056
00060 static bool initGL();
00061
00063 const MeshBuffer& operator = (const MeshBuffer& buffer);
00064
00066 const Mesh* getMesh() { return mesh_;}
00067
00069 void setMesh(const Mesh& mesh) {mesh_ = & mesh;}
00070
00072 bool initialize();
00073
00075 bool draw();
00076
00078 void clear();
00079
00081 void clearBuffer();
00082
00084 bool isBusy() const { return busy_;}
00085
00091 static void setGLRenderer(GLRenderer* renderer) { gl_renderer_ = renderer;}
00092
00093 protected:
00094
00095 const Mesh* mesh_;
00096 Buffer buffer_;
00097 bool filled_;
00098 static GLRenderer* gl_renderer_;
00099 bool busy_;
00100 bool multiple_colors_;
00101 ColorRGBA color_;
00102 Size vertices_;
00103 Size triangles_;
00104 };
00105
00106 }
00107 }
00108
00109 #endif // BALL_VIEW_RENDERING_VERTEXBUFFER_H