Katana Plug-in APIs 0.1

FnDrawingHelpers.h

00001 // Copyright (c) 2016 The Foundry Visionmongers Ltd. All Rights Reserved.
00002 
00003 #ifndef DRAWINGHELPERS_H_
00004 #define DRAWINGHELPERS_H_
00005 
00006 #include <GL/glew.h>
00007 #include <FnLogging/FnLogging.h>
00008 
00009 #include <cmath>
00010 #include <iostream>
00011 #include <string>
00012 
00013 #if defined(WIN32)
00014 #pragma warning (disable: 4275)
00015 #endif
00016 
00017 #if defined(WIN32)
00018 #pragma warning (default: 4275)
00019 #endif
00020 
00021 namespace Foundry
00022 {
00023 namespace Katana
00024 {
00025 namespace ViewerUtils
00026 {
00027 
00034 static inline double toRadians(double angleDegree)
00035 {
00036     return angleDegree * M_PI / 180.0;
00037 }
00038 
00039 static inline double toDegrees(double radians)
00040 {
00041     return radians * (180.0 / M_PI);
00042 }
00043 
00044 inline bool _initializeGlew(FnKat::FnLogging::FnLog& _fnLog)
00045 {
00046     const GLenum err = glewInit();
00047     if(err != GLEW_OK)
00048     {
00049         std::string errorMsg("Critical error in glewInit(): ");
00050         errorMsg += (const char*)glewGetErrorString(err);
00051         FnLogError(errorMsg.c_str());
00052         return false;
00053     }
00054     return true;
00055 }
00056 
00057 #define GLEW_INIT() Foundry::Katana::ViewerUtils::_initializeGlew(_fnLog)
00058 
00059 } // ViewerUtils
00060 } // Katana
00061 } // Foundry
00062 
00063 #endif /* DRAWINGHELPERS_H_ */
 All Classes Functions Variables Typedefs Enumerations Enumerator