]> git.tdb.fi Git - libs/gl.git/blob - source/primitivetype.cpp
Minor fixes to texture anisotropy handling
[libs/gl.git] / source / primitivetype.cpp
1 #include <msp/strings/format.h>
2 #include "primitivetype.h"
3
4 namespace Msp {
5 namespace GL {
6
7 void operator>>(const LexicalConverter &conv, PrimitiveType &pt)
8 {
9         if(conv.get()=="POINTS")
10                 pt = POINTS;
11         else if(conv.get()=="LINES")
12                 pt = LINES;
13         else if(conv.get()=="LINE_LOOP")
14                 pt = LINE_LOOP;
15         else if(conv.get()=="LINE_STRIP")
16                 pt = LINE_STRIP;
17         else if(conv.get()=="TRIANGLES")
18                 pt = TRIANGLES;
19         else if(conv.get()=="TRIANGLE_STRIP")
20                 pt = TRIANGLE_STRIP;
21         else if(conv.get()=="TRIANGLE_FAN")
22                 pt = TRIANGLE_FAN;
23         else if(conv.get()=="QUADS")
24                 pt = QUADS;
25         else if(conv.get()=="QUAD_STRIP")
26                 pt = QUAD_STRIP;
27         else
28                 throw lexical_error(format("conversion of '%s' to PrimitiveType", conv.get()));
29 }
30
31 void require_primitive_type(PrimitiveType type)
32 {
33         if(type==QUADS || type==QUAD_STRIP)
34                 static Require _req(MSP_legacy_features);
35 }
36
37 } // namespace GL
38 } // namespace Msp