source: trunk/src/gl/gl_window.cc @ 38

Last change on this file since 38 was 38, checked in by epyon, 12 years ago
  • gl_window added
  • gl_device added
  • NOVA library fully integrated into NV
File size: 1.3 KB
Line 
1// Copyright (C) 2012-2013 Kornel Kisielewicz
2// This file is part of NV Libraries.
3// For conditions of distribution and use, see copyright notice in nv.hh
4
5#include "nv/gl/gl_window.hh"
6
7#include "nv/logging.hh"
8#include "nv/lib/gl.hh"
9#include "nv/lib/sdl12.hh"
10
11using namespace nv;
12
13gl_window::gl_window( uint16 width, uint16 height )
14        : m_width( width ), m_height( height ), m_title("NV Engine"), m_screen( nullptr )
15{
16        int flags = SDL_OPENGL;
17       
18        m_screen = SDL_SetVideoMode( width, height, 32, flags );
19       
20        if ( m_screen == 0 )
21        {
22                NV_LOG( LOG_CRITICAL, "Video mode set failed: " << SDL_GetError( ) );
23                return; // TODO: Error report
24        }
25
26        nv::load_gl_library();
27        NV_LOG( LOG_INFO, "OpenGL Vendor       : " << glGetString(GL_VENDOR) );
28        NV_LOG( LOG_INFO, "OpenGL Renderer     : " << glGetString(GL_RENDERER) );
29        NV_LOG( LOG_INFO, "OpenGL Version      : " << glGetString(GL_VERSION) );
30        NV_LOG( LOG_INFO, "OpenGL GLSL Version : " << glGetString(GL_SHADING_LANGUAGE_VERSION) );
31}
32
33uint16 gl_window::get_width() const
34{
35        return m_width;
36}
37
38uint16 gl_window::get_height() const
39{
40        return m_height;
41}
42
43string gl_window::get_title() const
44{
45        return m_title;
46}
47
48void gl_window::set_title( const string& title )
49{
50        SDL_WM_SetCaption( title.c_str(), title.c_str() );
51        m_title = title;
52}
Note: See TracBrowser for help on using the repository browser.