Is there a way to identify which object is calling the draw method.
Creation:
joint.model = [[Box alloc] init];
The calling code:
[joint.model draw];
The draw method (within Box class):
-(void)draw
{
glBindVertexArrayOES(_boxVAO);
glDrawArrays(GL_TRIANGLES, 0, 7055*3);
}
How can i receive the joint object in my draw method?
If more class info is necessary i can attach, but i did not assume since theres not much more.
The
modelobject needs to have a pointer back tojointin order to use it in the-drawmethod. So you need to either modify theBoxclass to have a pointer to whatever typejointis, or ifBoxis defined by a framework you’re using, you need to subclass it. So you could do either:Or if that’s not an option, you could do this:
And make sure that
model.jointis created like this:Then in your draw method, you can simply access
modellike this: