X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fdatatype.cpp;fp=source%2Fdatatype.cpp;h=1def3ca31fa7363ff724448198f751cf6a8688b8;hb=fdffcd69528931fb181d2a076bcf42bfabd0085f;hp=0000000000000000000000000000000000000000;hpb=860aec7bfaabbad139d27dd7f4738984276e6676;p=libs%2Fgl.git diff --git a/source/datatype.cpp b/source/datatype.cpp new file mode 100644 index 00000000..1def3ca3 --- /dev/null +++ b/source/datatype.cpp @@ -0,0 +1,26 @@ +#include +#include "datatype.h" + +using namespace std; + +namespace Msp { +namespace GL { + +unsigned get_type_size(DataType type) +{ + switch(type) + { + case BYTE: + case UNSIGNED_BYTE: return 1; + case SHORT: + case UNSIGNED_SHORT: + case HALF_FLOAT: return 2; + case INT: + case UNSIGNED_INT: + case FLOAT: return 4; + default: throw invalid_argument("get_type_size"); + } +} + +} // namespace GL +} // namespace Msp