Listing 5
#define glFormatOf(T) (G3D::_internal::_GLFormat<T>::type())
template<class T> class _GLFormat {
public: static GLenum x() { return GL_NONE; }
};
#define DECLARE_GLFORMATOF(G3DType, GLType) \
template<> class _GLFormat<G3DType> { \
public: static GLenum type() { return GLType; } \
};
DECLARE_GLFORMATOF( Vector2, GL_FLOAT)
DECLARE_GLFORMATOF( Vector3, GL_FLOAT)
DECLARE_GLFORMATOF( Color3uint8, GL_UNSIGNED_BYTE)
class VAR {
public:
...
template<class T>
VAR(const Array<T>& source, VARAreaRef _area) {
init(source.getCArray(), source.size(), sizeof(T), glFormatOf(T), _area,);
}
};