Original Post
I am looking to implement some sort of DirectX style surface class that I can then inherit from to create variations such as texture or z buffer classes. Ok, now I want the resulting texture class to be able to store ANY type of image data, by this I mean any bit depth or format. E.g it would be able to store the image as a series of bytes for the r,g and b componants or as floating point values in order to accomodate hight dynamic range data (should it be required). Now I have implementted a generic buffer in C using an array of bytes to store the data which can then be accessed as whatever you want it to be. This works well (so far). But I was wondering if this was the best/ only way to do this in c++ or I should somehow make use of templates? Finally as an extension, in my c implementation I use a lock function which takes a void** and sets it to point at the data stored in the buffer. A matching unlock function also takes a void** which it then makes invalid. This is a bit clumsy I know so I was wondering how DirectX allows you to simply call an unlock function without passing in the pointer to the locked buffer? Any ideas? Any thoughts appreciated. Thank you all.