]> git.tdb.fi Git - libs/gl.git/blob - source/pixelformat.cpp
Support specifying elements in PrimitiveBuilder
[libs/gl.git] / source / pixelformat.cpp
1 /* $Id$
2
3 This file is part of libmspgl
4 Copyright © 2007  Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
6 */
7
8 #include "pixelformat.h"
9
10 using namespace std;
11
12 namespace Msp {
13 namespace GL {
14
15 istream &operator>>(istream &in, PixelFormat &fmt)
16 {
17         string word;
18
19         in>>word;
20         if(word=="COLOR_INDEX")
21                 fmt=COLOR_INDEX;
22         else if(word=="STENCIL_INDEX")
23                 fmt=STENCIL_INDEX;
24         else if(word=="DEPTH_COMPONENT")
25                 fmt=DEPTH_COMPONENT;
26         else if(word=="RED")
27                 fmt=RED;
28         else if(word=="GREEN")
29                 fmt=GREEN;
30         else if(word=="BLUE")
31                 fmt=BLUE;
32         else if(word=="ALPHA")
33                 fmt=ALPHA;
34         else if(word=="RGB")
35                 fmt=RGB;
36         else if(word=="RGBA")
37                 fmt=RGBA;
38         else if(word=="BGR")
39                 fmt=BGR;
40         else if(word=="BGRA")
41                 fmt=BGRA;
42         else if(word=="LUMINANCE")
43                 fmt=LUMINANCE;
44         else if(word=="LUMINANCE_ALPHA")
45                 fmt=LUMINANCE_ALPHA;
46         else
47                 in.setstate(ios_base::failbit);
48
49         return in;
50 }
51
52 } // namespace GL
53 } // namespace Msp