@adamtth wrote:
Hi. If I want to render more than 40000 instances I always run into this error EXC_BAD_ACCESS on
glBufferSubDatawhen I update the per instance attribute. (xcode). sometimes i can add more than 20000 but after a while i start to get this error, and after a few run i can add only 6000-8000 without EXC_BAD_ACCESSThe
updateInstance()runs in theofApp::update()function.Mostly the
mVboBox.getVbo().updateAttributeData(possize, &_size[0], _size.size());line triggers this error sometimes themVboBox.getVbo().updateAttributeData(posCoord, &_coord[0], _coord.size());. I check the values, and everything seems fine with the_coordand_sizebut i still got these errors after a few seconds.void ofApp::updateInstance() { vector<float> _coord; vector<float> _texcoord; vector<float> _brightness; vector<float> _type; vector<float> _height; vector<float> _size; for (int i = 0; i < 10000; i++) { if (i < mainWordArray.size()) { _texcoord.push_back(mainWordArray[i].word.x); _texcoord.push_back(mainWordArray[i].word.y); _coord.push_back(mainWordArray[i].x / float(PORT_WIDTH )); _coord.push_back(mainWordArray[i].y / float(PORT_HEIGHT)); _size.push_back(mainWordArray[i].word.width); _size.push_back(mainWordArray[i].word.height); _height.push_back(mainWordArray[i].height / float(PORT_HEIGHT)); _type.push_back( 6.0 ); } else { _texcoord.push_back(atlas.fboAtlases[0].szo[0].x); _texcoord.push_back(atlas.fboAtlases[0].szo[0].y); _coord.push_back(-10.0); _coord.push_back(-10.0); _size.push_back(atlas.fboAtlases[0].szo[0].width); _size.push_back(atlas.fboAtlases[0].szo[0].height); _height.push_back(1.0); _type.push_back( 6.0 ); } } mVboBox.getVbo().updateAttributeData(posCoord, &_coord[0], _coord.size()); mVboBox.getVbo().updateAttributeData(posheight, &_height[0], _height.size()); mVboBox.getVbo().updateAttributeData(postexcoord, &_texcoord[0], _texcoord.size()); mVboBox.getVbo().updateAttributeData(possize, &_size[0], _size.size()); mVboBox.getVbo().updateAttributeData(postype, &_type[0], _type.size()); }
Posts: 5
Participants: 2
