ClanLib  2.3.7
graphic_context_gl1.h
Go to the documentation of this file.
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2011 The ClanLib Team
4 **
5 ** This software is provided 'as-is', without any express or implied
6 ** warranty. In no event will the authors be held liable for any damages
7 ** arising from the use of this software.
8 **
9 ** Permission is granted to anyone to use this software for any purpose,
10 ** including commercial applications, and to alter it and redistribute it
11 ** freely, subject to the following restrictions:
12 **
13 ** 1. The origin of this software must not be misrepresented; you must not
14 ** claim that you wrote the original software. If you use this software
15 ** in a product, an acknowledgment in the product documentation would be
16 ** appreciated but is not required.
17 ** 2. Altered source versions must be plainly marked as such, and must not be
18 ** misrepresented as being the original software.
19 ** 3. This notice may not be removed or altered from any source distribution.
20 **
21 ** Note: Some of the libraries ClanLib may link to may have additional
22 ** requirements or restrictions.
23 **
24 ** File Author(s):
25 **
26 ** Mark Page
27 */
28 
31 
32 #pragma once
33 
34 #include "api_gl1.h"
35 #include "opengl1_defines.h"
36 #include "../Core/System/sharedptr.h"
37 #include "../Display/Render/graphic_context.h"
38 #include "material.h"
39 #include "light_source.h"
40 #include "texture_unit.h"
41 #include "light_model.h"
42 
47 class CL_GL1FrameBufferProvider;
48 class CL_GraphicContext_GL1_Impl;
49 
54 {
56 public:
57  // \brief Create a null instance
59 
62 
64 
66 public:
68  bool is_null() const { return !impl; }
69 
71  void throw_if_null() const;
72 
76  int get_max_texture_coords();
77 
81  int get_light_count();
82 
88  void get_opengl_version(int &version_major, int &version_minor, int &version_release);
89 
91 public:
92 
96  void push_texture_matrix(int unit_index);
97 
102  void set_texture_matrix(int unit_index, const CL_Mat4f &matrix);
103 
107  void pop_texture_matrix(int unit_index);
108 
112  void set_light_model(const CL_LightModel_GL1 &light_model);
113 
115  void reset_light_model();
116 
120  void set_material(const CL_Material_GL1 &material);
121 
125  void set_front_material(const CL_Material_GL1 &material);
126 
130  void set_back_material(const CL_Material_GL1 &material);
131 
133  void reset_front_material();
134 
136  void reset_back_material();
137 
142  void set_material(GLenum face, const CL_Material_GL1 &material);
143 
145  void reset_material();
146 
150  void set_color_material(CL_ColorMaterial_GL1 color);
151 
155  void set_color_material_front(CL_ColorMaterial_GL1 color);
156 
160  void set_color_material_back(CL_ColorMaterial_GL1 color);
161 
163  void reset_color_material();
164 
169  void set_color_material(GLenum face, CL_ColorMaterial_GL1 color);
170 
175  void set_light(int light_index, const CL_LightSource_GL1 &light);
176 
180  void reset_light(int light_index);
181 
186  void set_texture_unit(int unit_index, const CL_TextureUnit_GL1 &unit);
187 
191  void set_active();
192 
194 private:
195  CL_SharedPtr<CL_GraphicContext_GL1_Impl> impl;
196 };
197