Model class stores pointer to itself

Started by
2 comments, last by Paradigm Shifter 10 years, 5 months ago

I'm creating a class that handles models used for loading meshes and textures. When my engine goes to draw these models, it looks to an array of pointers that point to each model that's been initialized. How do I make the model class put a pointer to itself in this array? I've tried the "this" tag with no luck. Any ideas?

Airlight is looking for game developers
Advertisement

Nevermind, I tried using this again and It worked. After months of dealing with this I finally decide to post and it suddenly starts working. I guess I should start posting more often. wacko.png

Airlight is looking for game developers

Alright, I have another question.

If the array used to store these pointers was a static member of Model,

could I use it's constructor to add a pointer to itself in this array?

Airlight is looking for game developers

Yup. You can access static members from non static member functions. You can't do it the other way around though (unless the static member gets an object of the class type as an argument, or makes one that is used in the function, of course).

"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley

This topic is closed to new replies.

Advertisement