00001 /* 00002 ** ClanLib SDK 00003 ** Copyright (c) 1997-2011 The ClanLib Team 00004 ** 00005 ** This software is provided 'as-is', without any express or implied 00006 ** warranty. In no event will the authors be held liable for any damages 00007 ** arising from the use of this software. 00008 ** 00009 ** Permission is granted to anyone to use this software for any purpose, 00010 ** including commercial applications, and to alter it and redistribute it 00011 ** freely, subject to the following restrictions: 00012 ** 00013 ** 1. The origin of this software must not be misrepresented; you must not 00014 ** claim that you wrote the original software. If you use this software 00015 ** in a product, an acknowledgment in the product documentation would be 00016 ** appreciated but is not required. 00017 ** 2. Altered source versions must be plainly marked as such, and must not be 00018 ** misrepresented as being the original software. 00019 ** 3. This notice may not be removed or altered from any source distribution. 00020 ** 00021 ** Note: Some of the libraries ClanLib may link to may have additional 00022 ** requirements or restrictions. 00023 ** 00024 ** File Author(s): 00025 ** 00026 ** Mark Page 00027 */ 00028 00031 00032 #pragma once 00033 00034 #include "api_gl1.h" 00035 #include "opengl1_defines.h" 00036 #include "../Core/System/sharedptr.h" 00037 #include "../Display/Render/graphic_context.h" 00038 #include "material.h" 00039 #include "light_source.h" 00040 #include "texture_unit.h" 00041 #include "light_model.h" 00042 00043 class CL_RenderWindowProvider; 00044 class CL_ShaderObjectProvider; 00045 class CL_FrameBufferProvider; 00046 class CL_RenderBufferProvider; 00047 class CL_GL1FrameBufferProvider; 00048 class CL_GraphicContext_GL1_Impl; 00049 00053 class CL_API_GL1 CL_GraphicContext_GL1 : public CL_GraphicContext 00054 { 00056 public: 00057 // \brief Create a null instance 00058 CL_GraphicContext_GL1() {} 00059 00061 CL_GraphicContext_GL1(CL_GraphicContext &gc); 00062 00063 ~CL_GraphicContext_GL1(); 00064 00066 public: 00068 bool is_null() const { return !impl; } 00069 00071 void throw_if_null() const; 00072 00076 int get_max_texture_coords(); 00077 00081 int get_light_count(); 00082 00088 void get_opengl_version(int &version_major, int &version_minor, int &version_release); 00089 00091 public: 00092 00096 void push_texture_matrix(int unit_index); 00097 00102 void set_texture_matrix(int unit_index, const CL_Mat4f &matrix); 00103 00107 void pop_texture_matrix(int unit_index); 00108 00112 void set_light_model(const CL_LightModel_GL1 &light_model); 00113 00115 void reset_light_model(); 00116 00120 void set_material(const CL_Material_GL1 &material); 00121 00125 void set_front_material(const CL_Material_GL1 &material); 00126 00130 void set_back_material(const CL_Material_GL1 &material); 00131 00133 void reset_front_material(); 00134 00136 void reset_back_material(); 00137 00142 void set_material(GLenum face, const CL_Material_GL1 &material); 00143 00145 void reset_material(); 00146 00150 void set_color_material(CL_ColorMaterial_GL1 color); 00151 00155 void set_color_material_front(CL_ColorMaterial_GL1 color); 00156 00160 void set_color_material_back(CL_ColorMaterial_GL1 color); 00161 00163 void reset_color_material(); 00164 00169 void set_color_material(GLenum face, CL_ColorMaterial_GL1 color); 00170 00175 void set_light(int light_index, const CL_LightSource_GL1 &light); 00176 00180 void reset_light(int light_index); 00181 00186 void set_texture_unit(int unit_index, const CL_TextureUnit_GL1 &unit); 00187 00191 void set_active(); 00192 00194 private: 00195 CL_SharedPtr<CL_GraphicContext_GL1_Impl> impl; 00196 }; 00197