comparison Samples/Sdl/BasicScene.cpp @ 613:412a2d01a189

automatic initialization of glew
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 30 Apr 2019 16:44:23 +0200
parents e3f21a265be5
children 7efa2543699d
comparison
equal deleted inserted replaced
612:ba72bffceb7d 613:412a2d01a189
272 } 272 }
273 273
274 274
275 void Run(OrthancStone::Scene2D& scene) 275 void Run(OrthancStone::Scene2D& scene)
276 { 276 {
277
278 OrthancStone::SdlOpenGLWindow window("Hello", 1024, 768); 277 OrthancStone::SdlOpenGLWindow window("Hello", 1024, 768);
279 278
280 GLenum err = glewInit();
281 if (GLEW_OK != err)
282 {
283 throw std::runtime_error("GLEW_OK != err");
284 }
285
286 scene.FitContent(window.GetCanvasWidth(), window.GetCanvasHeight()); 279 scene.FitContent(window.GetCanvasWidth(), window.GetCanvasHeight());
287
288 280
289 glEnable(GL_DEBUG_OUTPUT); 281 glEnable(GL_DEBUG_OUTPUT);
290 glDebugMessageCallback(OpenGLMessageCallback, 0 ); 282 glDebugMessageCallback(OpenGLMessageCallback, 0);
291 283
292 OrthancStone::OpenGLCompositor compositor(window, scene); 284 OrthancStone::OpenGLCompositor compositor(window, scene);
293 compositor.SetFont(0, Orthanc::EmbeddedResources::UBUNTU_FONT, 285 compositor.SetFont(0, Orthanc::EmbeddedResources::UBUNTU_FONT,
294 FONT_SIZE, Orthanc::Encoding_Latin1); 286 FONT_SIZE, Orthanc::Encoding_Latin1);
295 287
366 * to `SDL_main'". https://wiki.libsdl.org/FAQWindows 358 * to `SDL_main'". https://wiki.libsdl.org/FAQWindows
367 **/ 359 **/
368 int main(int argc, char* argv[]) 360 int main(int argc, char* argv[])
369 { 361 {
370 OrthancStone::StoneInitialize(); 362 OrthancStone::StoneInitialize();
363 Orthanc::Logging::EnableInfoLevel(true);
371 364
372 try 365 try
373 { 366 {
374 OrthancStone::Scene2D scene; 367 OrthancStone::Scene2D scene;
375 PrepareScene(scene); 368 PrepareScene(scene);