44 #include <ACG/GL/acg_glew.hh> 45 #include "MeshNode2T.hh" 46 #include "MeshNode2T_impl.hh" 51 MeshNodeBase::MeshNodeBase(
BaseNode* _parent, std::string _name) :
59 void MeshNodeBase::supplyDrawMesh(DrawMeshBase *drawMeshBase) {
65 throw std::runtime_error(
"MeshNodeBase::supplyDrawMesh called " 68 throw std::runtime_error(
"MeshNodeBase::supplyDrawMesh called " 69 "with NULL parameter.");
71 drawMeshBase_ = drawMeshBase;
74 void MeshNodeBase::updatePolyEdgeBuf()
79 assert(drawMeshBase_);
81 MeshCompiler *
const mc = drawMeshBase_->getMeshCompiler();
82 if (mc && !mc->isTriangleMesh())
86 glGenBuffers(1, &polyEdgeBuf_);
88 const int nTris = mc->getNumTriangles();
90 const int newBufSize = (nTris/2+1);
92 if (polyEdgeBufSize_ != newBufSize)
94 glBindBuffer(GL_TEXTURE_BUFFER, polyEdgeBuf_);
106 polyEdgeBufSize_ = newBufSize;
107 unsigned char* polyEdgeBufData =
new unsigned char[newBufSize];
110 memset(polyEdgeBufData, 0, newBufSize);
113 for (
int i = 0; i < nTris; ++i)
116 int bitidx = (i&1) * 3;
118 for (
int k = 0; k < 3; ++k)
119 if (mc->isFaceEdge(i, k))
120 polyEdgeBufData[byteidx] += 1 << (k + bitidx);
123 glBufferData(GL_TEXTURE_BUFFER, polyEdgeBufSize_, polyEdgeBufData, GL_STATIC_DRAW);
126 delete [] polyEdgeBufData;
131 if (!polyEdgeBufTex_)
133 glGenTextures(1, &polyEdgeBufTex_);
135 glActiveTexture(GL_TEXTURE0);
136 glBindTexture(GL_TEXTURE_BUFFER, polyEdgeBufTex_);
137 glTexBuffer(GL_TEXTURE_BUFFER, GL_R8UI, polyEdgeBuf_);
139 glBindTexture(GL_TEXTURE_2D, 0);
Namespace providing different geometric functions concerning angles.
void compatibilityProfile(bool _enableCoreProfile)
Store opengl core profile setting.