Advertisement

trying to make a class that makes quads

Started by August 22, 2002 01:33 PM
11 comments, last by Da cobra 22 years, 4 months ago
thanx I changed my class again so my pointer to a VB is now a private member and all works fine now

anything I should worry about when using a pointer as a private member?
As stated in my post above, when dealing with a private member that is a pointer to an external variable you could run into the danger of having the external destroyed, invalidating the private pointer. However, the class would know nothing of the object''s demise and would continue to use the pointer as if it was valid which will cause your program to barf.

In my sprite class I use this method and then just assume that the user of the class will be smart enough to stop using/re-initialize the class when the pointer becomes invalid. I also give the user the option to have the sprite class manage itself instead. While this is less efficient than the former choice (each sprite has it''s own tiny vb), it does give a bit of automation.

So, as always when working with pointers, you just need to be careful.

*Side note*
If you use ATL, there is a class to help manage COM pointers, CComPtr. You may also want to look into that


The hackers must have gotten into the system through the hyperlink!!

Invader''s Realm
Advertisement
Well i see ur problem, and i think the above fix is the best way to go TOTALLY private VertexBuffers... u might get rendering problems tho... i recommend doing the above thing just make sure uve got ur render stuff down pat!

This topic is closed to new replies.

Advertisement