ClanLib  2.3.7
opengl.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 ** Magnus Norddahl
27 */
28 
31 
32 #pragma once
33 
34 #include "api_gl.h"
35 #include "opengl_defines.h"
36 #include <utility>
37 #include "../Core/Text/string_types.h"
38 #include "../Display/Image/pixel_format.h"
39 #include "../Display/Render/texture.h"
40 
41 class CL_GLFunctions;
42 class CL_GraphicContext;
43 class CL_OpenGLGraphicContextProvider;
44 
45 enum CL_TextureFormat;
46 
48 typedef void (CL_ProcAddress)();
49 
54 {
57 
58 public:
60  static CL_ProcAddress *get_proc_address(const CL_String8 &function_name);
61 
64 
66  static int get_textureformat_bits(CL_TextureFormat format);
67 
69 
71  static bool to_opengl_pixelformat(CL_TextureFormat texture_format, GLenum &format, GLenum &type);
72 
78  static void to_opengl_textureformat(CL_TextureFormat format, GLint &gl_internal_format, GLenum &gl_pixel_format);
79 
81  static void set_active(CL_GraphicContext &gc);
82 
84  static void set_active(const CL_OpenGLGraphicContextProvider * const gc_provider);
85 
91  static bool set_active();
92 
96  static void check_error();
97 
99  static int get_opengl_version_major() {return opengl_version_major;}
100 
102  static int get_opengl_version_minor() {return opengl_version_minor;}
103 
105  static int get_glsl_version_major() {return glsl_version_major;}
106 
108  static int get_glsl_version_minor() {return glsl_version_minor;}
109 
111 
112 private:
116  static void remove_active(const CL_OpenGLGraphicContextProvider * const gc_provider);
117 
118  static int opengl_version_major;
119  static int opengl_version_minor;
120  static int glsl_version_major;
121  static int glsl_version_minor;
122 
123  friend class CL_OpenGLGraphicContextProvider;
124 
125 };
126