1 /***********************************************************************
2 created: 24/9/2004
3 author: Paul D Turner
4 *************************************************************************/
5 /***************************************************************************
6 * Copyright (C) 2004 - 2009 Paul D Turner & The CEGUI Development Team
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining
9 * a copy of this software and associated documentation files (the
10 * "Software"), to deal in the Software without restriction, including
11 * without limitation the rights to use, copy, modify, merge, publish,
12 * distribute, sublicense, and/or sell copies of the Software, and to
13 * permit persons to whom the Software is furnished to do so, subject to
14 * the following conditions:
15 *
16 * The above copyright notice and this permission notice shall be
17 * included in all copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
23 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 * OTHER DEALINGS IN THE SOFTWARE.
26 ***************************************************************************/
27
28 // We need to include windows.h here before glfw is included (via
29 // CEGuiOpenGL3BaseApplication.h) or there will be a warning when GL.h includes
30 // windows.h (via GL3Renderer.h)
31 #if defined(CEGUI_USE_GLEW) && (defined( __WIN32__ ) || defined( _WIN32 ))
32 #include "windows.h"
33 #endif
34
35 #include "CEGuiOpenGL3BaseApplication.h"
36 #include "CEGUI/RendererModules/OpenGL/GL3Renderer.h"
37
38 //----------------------------------------------------------------------------//
CEGuiOpenGL3BaseApplication()39 CEGuiOpenGL3BaseApplication::CEGuiOpenGL3BaseApplication()
40 {
41 initGLFW();
42 setGLFWWindowCreationHints();
43 createGLFWWindow();
44 setGLFWAppConfiguration();
45
46 d_renderer = &CEGUI::OpenGL3Renderer::create();
47 }
48
49 //----------------------------------------------------------------------------//
setGLFWWindowCreationHints()50 void CEGuiOpenGL3BaseApplication::setGLFWWindowCreationHints()
51 {
52 #if GLFW_VERSION_MAJOR >= 3
53 glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
54 glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
55 glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
56 #else // GLFW_VERSION_MAJOR <= 2
57 glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3);
58 glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 2);
59 glfwOpenWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
60 #endif
61 }
62
63 //----------------------------------------------------------------------------//
64