| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
#ifndef CVD_GLES1_TYPES_H |
| 5 |
#define CVD_GLES1_TYPES_H |
| 6 |
|
| 7 |
#include <cvd/byte.h> |
| 8 |
#include <cvd/la.h> |
| 9 |
#include <cvd/rgb.h> |
| 10 |
#include <cvd/rgb8.h> |
| 11 |
#include <cvd/rgba.h> |
| 12 |
|
| 13 |
namespace CVD |
| 14 |
{ |
| 15 |
|
| 16 |
namespace gl |
| 17 |
{ |
| 18 |
template <class C> |
| 19 |
struct data; |
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
template <> |
| 24 |
struct data<unsigned char> |
| 25 |
{ |
| 26 |
static const int format = GL_LUMINANCE; |
| 27 |
static const int type = GL_UNSIGNED_BYTE; |
| 28 |
}; |
| 29 |
|
| 30 |
template <> |
| 31 |
struct data<signed char> |
| 32 |
{ |
| 33 |
static const int format = GL_LUMINANCE; |
| 34 |
static const int type = GL_BYTE; |
| 35 |
}; |
| 36 |
|
| 37 |
template <> |
| 38 |
struct data<unsigned short> |
| 39 |
{ |
| 40 |
static const int format = GL_LUMINANCE; |
| 41 |
static const int type = GL_UNSIGNED_SHORT; |
| 42 |
}; |
| 43 |
|
| 44 |
template <> |
| 45 |
struct data<short> |
| 46 |
{ |
| 47 |
static const int format = GL_LUMINANCE; |
| 48 |
static const int type = GL_SHORT; |
| 49 |
}; |
| 50 |
|
| 51 |
template <> |
| 52 |
struct data<float> |
| 53 |
{ |
| 54 |
static const int format = GL_LUMINANCE; |
| 55 |
static const int type = GL_FLOAT; |
| 56 |
}; |
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
template <> |
| 61 |
struct data<Rgb<unsigned char>> |
| 62 |
{ |
| 63 |
static const int format = GL_RGB; |
| 64 |
static const int type = GL_UNSIGNED_BYTE; |
| 65 |
}; |
| 66 |
|
| 67 |
template <> |
| 68 |
struct data<Rgb<signed char>> |
| 69 |
{ |
| 70 |
static const int format = GL_RGB; |
| 71 |
static const int type = GL_BYTE; |
| 72 |
}; |
| 73 |
|
| 74 |
template <> |
| 75 |
struct data<Rgb<unsigned short>> |
| 76 |
{ |
| 77 |
static const int format = GL_RGB; |
| 78 |
static const int type = GL_UNSIGNED_SHORT; |
| 79 |
}; |
| 80 |
|
| 81 |
template <> |
| 82 |
struct data<Rgb<short>> |
| 83 |
{ |
| 84 |
static const int format = GL_RGB; |
| 85 |
static const int type = GL_SHORT; |
| 86 |
}; |
| 87 |
|
| 88 |
template <> |
| 89 |
struct data<Rgb<float>> |
| 90 |
{ |
| 91 |
static const int format = GL_RGB; |
| 92 |
static const int type = GL_FLOAT; |
| 93 |
}; |
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
template <> |
| 98 |
struct data<Rgba<unsigned char>> |
| 99 |
{ |
| 100 |
static const int format = GL_RGBA; |
| 101 |
static const int type = GL_UNSIGNED_BYTE; |
| 102 |
}; |
| 103 |
|
| 104 |
template <> |
| 105 |
struct data<Rgba<signed char>> |
| 106 |
{ |
| 107 |
static const int format = GL_RGBA; |
| 108 |
static const int type = GL_BYTE; |
| 109 |
}; |
| 110 |
|
| 111 |
template <> |
| 112 |
struct data<Rgba<unsigned short>> |
| 113 |
{ |
| 114 |
static const int format = GL_RGBA; |
| 115 |
static const int type = GL_UNSIGNED_SHORT; |
| 116 |
}; |
| 117 |
|
| 118 |
template <> |
| 119 |
struct data<Rgba<short>> |
| 120 |
{ |
| 121 |
static const int format = GL_RGBA; |
| 122 |
static const int type = GL_SHORT; |
| 123 |
}; |
| 124 |
|
| 125 |
template <> |
| 126 |
struct data<Rgba<float>> |
| 127 |
{ |
| 128 |
static const int format = GL_RGBA; |
| 129 |
static const int type = GL_FLOAT; |
| 130 |
}; |
| 131 |
|
| 132 |
|
| 133 |
template <> |
| 134 |
struct data<La<unsigned char>> |
| 135 |
{ |
| 136 |
static const int format = GL_LUMINANCE_ALPHA; |
| 137 |
static const int type = GL_UNSIGNED_BYTE; |
| 138 |
}; |
| 139 |
|
| 140 |
template <> |
| 141 |
struct data<La<signed char>> |
| 142 |
{ |
| 143 |
static const int format = GL_LUMINANCE_ALPHA; |
| 144 |
static const int type = GL_BYTE; |
| 145 |
}; |
| 146 |
|
| 147 |
template <> |
| 148 |
struct data<La<unsigned short>> |
| 149 |
{ |
| 150 |
static const int format = GL_LUMINANCE_ALPHA; |
| 151 |
static const int type = GL_UNSIGNED_SHORT; |
| 152 |
}; |
| 153 |
|
| 154 |
template <> |
| 155 |
struct data<La<short>> |
| 156 |
{ |
| 157 |
static const int format = GL_LUMINANCE_ALPHA; |
| 158 |
static const int type = GL_SHORT; |
| 159 |
}; |
| 160 |
|
| 161 |
template <> |
| 162 |
struct data<La<float>> |
| 163 |
{ |
| 164 |
static const int format = GL_LUMINANCE_ALPHA; |
| 165 |
static const int type = GL_FLOAT; |
| 166 |
}; |
| 167 |
|
| 168 |
|
| 169 |
|
| 170 |
template <> |
| 171 |
struct data<Rgb8> |
| 172 |
{ |
| 173 |
static const int format = GL_RGBA; |
| 174 |
static const int type = GL_UNSIGNED_BYTE; |
| 175 |
}; |
| 176 |
|
| 177 |
}; |
| 178 |
|
| 179 |
}; |
| 180 |
|
| 181 |
#endif |