44 #include <ACG/GL/acg_glew.hh> 45 #include "MeshNode2T.hh" 50 MeshNodeBase::MeshNodeBase(
BaseNode* _parent, std::string _name) :
58 void MeshNodeBase::supplyDrawMesh(DrawMeshBase *drawMeshBase) {
64 throw std::runtime_error(
"MeshNodeBase::supplyDrawMesh called " 67 throw std::runtime_error(
"MeshNodeBase::supplyDrawMesh called " 68 "with NULL parameter.");
70 drawMeshBase_ = drawMeshBase;
73 void MeshNodeBase::updatePolyEdgeBuf()
78 assert(drawMeshBase_);
80 MeshCompiler *
const mc = drawMeshBase_->getMeshCompiler();
81 if (mc && !mc->isTriangleMesh())
85 glGenBuffers(1, &polyEdgeBuf_);
87 const int nTris = mc->getNumTriangles();
89 const int newBufSize = (nTris/2+1);
91 if (polyEdgeBufSize_ != newBufSize)
93 glBindBuffer(GL_TEXTURE_BUFFER, polyEdgeBuf_);
105 polyEdgeBufSize_ = newBufSize;
106 unsigned char* polyEdgeBufData =
new unsigned char[newBufSize];
109 memset(polyEdgeBufData, 0, newBufSize);
112 for (
int i = 0; i < nTris; ++i)
115 int bitidx = (i&1) * 3;
117 for (
int k = 0; k < 3; ++k)
118 if (mc->isFaceEdge(i, k))
119 polyEdgeBufData[byteidx] += 1 << (k + bitidx);
122 glBufferData(GL_TEXTURE_BUFFER, polyEdgeBufSize_, polyEdgeBufData, GL_STATIC_DRAW);
125 delete [] polyEdgeBufData;
130 if (!polyEdgeBufTex_)
132 glGenTextures(1, &polyEdgeBufTex_);
134 glActiveTexture(GL_TEXTURE0);
135 glBindTexture(GL_TEXTURE_BUFFER, polyEdgeBufTex_);
136 glTexBuffer(GL_TEXTURE_BUFFER, GL_R8UI, polyEdgeBuf_);
138 glBindTexture(GL_TEXTURE_2D, 0);
Namespace providing different geometric functions concerning angles.
void compatibilityProfile(bool _enableCoreProfile)
Store opengl core profile setting.