12 |
// |
// |
13 |
// $Id$ |
// $Id$ |
14 |
// $Log$ |
// $Log$ |
15 |
|
// Revision 1.9 2004/12/26 08:03:34 skunix |
16 |
|
// changed lambda::bind's to boost::binds |
17 |
|
// |
18 |
// Revision 1.8 2004/12/25 19:21:44 skunix |
// Revision 1.8 2004/12/25 19:21:44 skunix |
19 |
// removed extra stuff |
// removed extra stuff |
20 |
// |
// |
28 |
|
|
29 |
#include "system.hpp" |
#include "system.hpp" |
30 |
#include <SDL.h> |
#include <SDL.h> |
|
#include <GL/gl.h> |
|
31 |
#include <stdexcept> |
#include <stdexcept> |
32 |
#include <algorithm> |
#include <algorithm> |
33 |
#include <iostream> |
#include <iostream> |
34 |
|
#include <GL/glew.h> |
35 |
|
#include "log.hpp" |
36 |
namespace usata |
namespace usata |
37 |
{ |
{ |
38 |
|
|
39 |
|
|
40 |
namespace system |
namespace system |
41 |
{ |
{ |
42 |
|
static bool glew_was_init = false; |
43 |
|
void init_glew() |
44 |
|
{ |
45 |
|
if (glew_was_init) |
46 |
|
return; // everything is ok :) |
47 |
|
GLenum err = glewInit(); |
48 |
|
if (err != GLEW_OK) |
49 |
|
{ |
50 |
|
throw std::runtime_error((const char*)(glewGetErrorString(err))); |
51 |
|
} |
52 |
|
|
53 |
|
log::Stream s(&log::server); |
54 |
|
s << "GLEW initialized\n"; |
55 |
|
|
56 |
|
return; |
57 |
|
} |
58 |
|
|
59 |
|
|
60 |
static bool initialized = false; |
static bool initialized = false; |
61 |
void init() |
void init() |
62 |
{ |
{ |
143 |
{ |
{ |
144 |
SDL_GL_GetAttribute(SDL_GL_DEPTH_SIZE,&depth); |
SDL_GL_GetAttribute(SDL_GL_DEPTH_SIZE,&depth); |
145 |
std::cout << "set video mode ok, GL_DEPTH_SIZE (" << depth <<")" << std::endl; |
std::cout << "set video mode ok, GL_DEPTH_SIZE (" << depth <<")" << std::endl; |
146 |
|
init_glew(); |
147 |
} |
} |
148 |
else |
else |
149 |
{ |
{ |