00001 /* 00002 This file is part of the CVD Library. 00003 00004 Copyright (C) 2005 The Authors 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Lesser General Public 00008 License as published by the Free Software Foundation; either 00009 version 2.1 of the License, or (at your option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Lesser General Public License for more details. 00015 00016 You should have received a copy of the GNU Lesser General Public 00017 License along with this library; if not, write to the Free Software 00018 Foundation, Inc., 00019 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00020 */ 00021 // Pulled out of gl_helpers to make documentation neater 00022 // Paul Smith 20/4/05 00023 00024 #ifndef CVD_GL_TYPES_H 00025 #define CVD_GL_TYPES_H 00026 00027 #include <cvd/byte.h> 00028 #include <cvd/rgb.h> 00029 #include <cvd/byte.h> 00030 #include <cvd/rgb8.h> 00031 #include <cvd/rgba.h> 00032 #include <cvd/la.h> 00033 00034 namespace CVD 00035 { 00036 00037 namespace gl 00038 { 00039 template<class C> struct data; 00040 00041 //Scalar types 00042 00043 template<> struct data<unsigned char> 00044 { 00045 static const int format=GL_LUMINANCE; 00046 static const int type =GL_UNSIGNED_BYTE; 00047 }; 00048 00049 template<> struct data<signed char> 00050 { 00051 static const int format=GL_LUMINANCE; 00052 static const int type =GL_BYTE; 00053 }; 00054 00055 template<> struct data<unsigned short> 00056 { 00057 static const int format=GL_LUMINANCE; 00058 static const int type =GL_UNSIGNED_SHORT; 00059 }; 00060 00061 template<> struct data<short> 00062 { 00063 static const int format=GL_LUMINANCE; 00064 static const int type =GL_SHORT; 00065 }; 00066 00067 template<> struct data<unsigned int> 00068 { 00069 static const int format=GL_LUMINANCE; 00070 static const int type =GL_UNSIGNED_INT; 00071 }; 00072 00073 template<> struct data<int> 00074 { 00075 static const int format=GL_LUMINANCE; 00076 static const int type =GL_INT; 00077 }; 00078 00079 template<> struct data<float> 00080 { 00081 static const int format=GL_LUMINANCE; 00082 static const int type =GL_FLOAT; 00083 }; 00084 00085 template<> struct data<double> 00086 { 00087 static const int format=GL_LUMINANCE; 00088 static const int type =GL_DOUBLE; 00089 }; 00090 00091 00092 00093 //Rgb<*> types 00094 00095 template<> struct data<Rgb<unsigned char> > 00096 { 00097 static const int format=GL_RGB; 00098 static const int type =GL_UNSIGNED_BYTE; 00099 }; 00100 00101 template<> struct data<Rgb<signed char> > 00102 { 00103 static const int format=GL_RGB; 00104 static const int type =GL_BYTE; 00105 }; 00106 00107 template<> struct data<Rgb<unsigned short> > 00108 { 00109 static const int format=GL_RGB; 00110 static const int type =GL_UNSIGNED_SHORT; 00111 }; 00112 00113 template<> struct data<Rgb<short> > 00114 { 00115 static const int format=GL_RGB; 00116 static const int type =GL_SHORT; 00117 }; 00118 00119 template<> struct data<Rgb<unsigned int> > 00120 { 00121 static const int format=GL_RGB; 00122 static const int type =GL_UNSIGNED_INT; 00123 }; 00124 00125 template<> struct data<Rgb<int> > 00126 { 00127 static const int format=GL_RGB; 00128 static const int type =GL_INT; 00129 }; 00130 00131 template<> struct data<Rgb<float> > 00132 { 00133 static const int format=GL_RGB; 00134 static const int type =GL_FLOAT; 00135 }; 00136 00137 template<> struct data<Rgb<double> > 00138 { 00139 static const int format=GL_RGB; 00140 static const int type =GL_DOUBLE; 00141 }; 00142 00143 00144 //Rgba<*> types 00145 00146 template<> struct data<Rgba<unsigned char> > 00147 { 00148 static const int format=GL_RGBA; 00149 static const int type =GL_UNSIGNED_BYTE; 00150 }; 00151 00152 template<> struct data<Rgba<signed char> > 00153 { 00154 static const int format=GL_RGBA; 00155 static const int type =GL_BYTE; 00156 }; 00157 00158 template<> struct data<Rgba<unsigned short> > 00159 { 00160 static const int format=GL_RGBA; 00161 static const int type =GL_UNSIGNED_SHORT; 00162 }; 00163 00164 template<> struct data<Rgba<short> > 00165 { 00166 static const int format=GL_RGBA; 00167 static const int type =GL_SHORT; 00168 }; 00169 00170 template<> struct data<Rgba<unsigned int> > 00171 { 00172 static const int format=GL_RGBA; 00173 static const int type =GL_UNSIGNED_INT; 00174 }; 00175 00176 template<> struct data<Rgba<int> > 00177 { 00178 static const int format=GL_RGBA; 00179 static const int type =GL_INT; 00180 }; 00181 00182 template<> struct data<Rgba<float> > 00183 { 00184 static const int format=GL_RGBA; 00185 static const int type =GL_FLOAT; 00186 }; 00187 00188 template<> struct data<Rgba<double> > 00189 { 00190 static const int format=GL_RGBA; 00191 static const int type =GL_DOUBLE; 00192 }; 00193 00194 00195 //La<*> types 00196 template<> struct data<La<unsigned char> > 00197 { 00198 static const int format=GL_LUMINANCE_ALPHA; 00199 static const int type =GL_UNSIGNED_BYTE; 00200 }; 00201 00202 template<> struct data<La<signed char> > 00203 { 00204 static const int format=GL_LUMINANCE_ALPHA; 00205 static const int type =GL_BYTE; 00206 }; 00207 00208 template<> struct data<La<unsigned short> > 00209 { 00210 static const int format=GL_LUMINANCE_ALPHA; 00211 static const int type =GL_UNSIGNED_SHORT; 00212 }; 00213 00214 template<> struct data<La<short> > 00215 { 00216 static const int format=GL_LUMINANCE_ALPHA; 00217 static const int type =GL_SHORT; 00218 }; 00219 00220 template<> struct data<La<unsigned int> > 00221 { 00222 static const int format=GL_LUMINANCE_ALPHA; 00223 static const int type =GL_UNSIGNED_INT; 00224 }; 00225 00226 template<> struct data<La<int> > 00227 { 00228 static const int format=GL_LUMINANCE_ALPHA; 00229 static const int type =GL_INT; 00230 }; 00231 00232 template<> struct data<La<float> > 00233 { 00234 static const int format=GL_LUMINANCE_ALPHA; 00235 static const int type =GL_FLOAT; 00236 }; 00237 00238 template<> struct data<La<double> > 00239 { 00240 static const int format=GL_LUMINANCE_ALPHA; 00241 static const int type =GL_DOUBLE; 00242 }; 00243 00244 //Rgb8 type 00245 00246 template<> struct data<Rgb8> 00247 { 00248 static const int format=GL_RGBA; 00249 static const int type =GL_UNSIGNED_BYTE; 00250 }; 00251 00252 }; 00253 00254 00255 }; 00256 00257 #endif