-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LineShape in iOS #212
Comments
Hi @mememto It doesn't look like a G3M issue. BTW, taking a very quick overview, the problem seems to be that _cartesianStartPos pointer is not initialized to NULL and it has a dangling pointer. |
And please google for "xcode add exception breakpoint". It's very helpful to know where the exception is thrown. |
Hi @DiegoGomezDeck. Thanks for your tip, i will check in some hours and let you know something. |
Hi again @DiegoGomezDeck. I've initialized _cartesianStartPos to NULL, but the same thing happens. To get deep into the issue this is how i use LineShape:
This method is called several times, since the number of CLLocation elements inside points array is increased or decreased depending on user. My objective is to draw a multi-line. If there are at least two CLLocation elements inside points array, the for loop creates one new ShapeLine and add it to shapesRenderer:
This works fine. The problem takes place when one CLLocation element is added to points array and the paintLines method is called again. This time, the |
One more thing, commenting the |
You're passing object hold in _color and also deleting it from the constructor. DirectMesh assumes it's the owner of _flatColor pointer and handles its deletion. |
Sure, you're drawing straight lines and the earth surface has a curvature. Disabling depth test helps sometimes. |
Thanks for your help @DiegoGomezDeck |
Hi to everyone and thanks in advance. I've made LineShape class for iOS but i'm experiencing some kind of problems. The class seems to work fine, but whenever I call shapesRenderer->removeAllShapes(); i get the following exception:
pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Not sure of what is causing this. Any help would be appreciated since it's been years since the last time i used C++ :/ By the way sorry for the indentation, not sure of how to do this :/
.HPP
class LineShape : public AbstractMeshShape {
private:
void computeOrientationParams(const Planet *planet);
protected:
Mesh* createMesh(const G3MRenderContext* rc);
public:
float _width;
Color* _color;
Vector3D* _cartesianStartPos;
Geodetic3D* _geodeticEndPos;
std::vector<double> intersectionsDistances(const Planet* planet, const Vector3D& origin, const Vector3D& direction) const;
};
.CPP
void LineShape::computeOrientationParams(const Planet *planet) {
}
Mesh* LineShape::createMesh(const G3MRenderContext* rc) {
FloatBufferBuilderFromCartesian3D* vertices = FloatBufferBuilderFromCartesian3D::builderWithoutCenter();
vertices->add(0.0f, 0.0f, 0.0f);
vertices->add(0.0f, 0.0f, 1.0f);
}
std::vector<double> LineShape::intersectionsDistances(const Planet* planet, const Vector3D& origin, const Vector3D& direction) const {
}
The text was updated successfully, but these errors were encountered: