comparison Framework/StoneInitialization.cpp @ 611:e3f21a265be5

Added version directive to GLSL shader code + glew init function in sample code AND commented-out glew init function in StoneInitialize
author Benjamin Golinvaux <bgo@osimis.io>
date Tue, 30 Apr 2019 16:07:48 +0200
parents 0c4c0693b97c
children ba72bffceb7d
comparison
equal deleted inserted replaced
610:0c4c0693b97c 611:e3f21a265be5
19 **/ 19 **/
20 20
21 21
22 #include "StoneInitialization.h" 22 #include "StoneInitialization.h"
23 23
24 #include <Core/OrthancException.h>
24 #include <Core/Logging.h> 25 #include <Core/Logging.h>
25 26
26 #if !defined(ORTHANC_ENABLE_SDL) 27 #if !defined(ORTHANC_ENABLE_SDL)
27 # error Macro ORTHANC_ENABLE_SDL must be defined 28 # error Macro ORTHANC_ENABLE_SDL must be defined
28 #endif 29 #endif
30 31
31 #if ORTHANC_ENABLE_SDL == 1 32 #if ORTHANC_ENABLE_SDL == 1
32 # include "../Applications/Sdl/SdlWindow.h" 33 # include "../Applications/Sdl/SdlWindow.h"
33 #endif 34 #endif
34 35
36 #if ORTHANC_ENABLE_OPENGL == 1
37 # include "GL/glew.h"
38 #endif
35 39
36 namespace OrthancStone 40 namespace OrthancStone
37 { 41 {
38 void StoneInitialize() 42 void StoneInitialize()
39 { 43 {
40 Orthanc::Logging::Initialize(); 44 Orthanc::Logging::Initialize();
45
46 #if 0
47 #if ORTHANC_ENABLE_OPENGL == 1
48 glEnable(GL_DEBUG_OUTPUT);
49 GLenum err = glewInit();
50 if (GLEW_OK != err)
51 {
52 const char* error =
53 reinterpret_cast<const char*>(glewGetErrorString(err));
54 if (strcmp(error, "Missing GL version") != 0)
55 {
56 std::stringstream msg;
57 msg << "Error while initializing OpenGL through GLEW: " << error;
58 throw Orthanc::OrthancException(
59 Orthanc::ErrorCode_InternalError,msg.str());
60 }
61 }
62 {
63 std::stringstream message;
64 message << "Using GLEW version " << reinterpret_cast<const char*>(
65 glewGetString(GLEW_VERSION));
66 LOG(INFO) << "Using GLEW version " << message.str();
67 }
68 #endif
69 #endif
41 70
42 #if ORTHANC_ENABLE_SDL == 1 71 #if ORTHANC_ENABLE_SDL == 1
43 OrthancStone::SdlWindow::GlobalInitialize(); 72 OrthancStone::SdlWindow::GlobalInitialize();
44 #endif 73 #endif
45 } 74 }