scg3  0.6
scg_utilities.h
Go to the documentation of this file.
1 
9 /*
10  * Copyright 2014 Volker Ahlers
11  *
12  * Licensed under the Apache License, Version 2.0 (the "License");
13  * you may not use this file except in compliance with the License.
14  * You may obtain a copy of the License at
15  *
16  * http://www.apache.org/licenses/LICENSE-2.0
17  *
18  * Unless required by applicable law or agreed to in writing, software
19  * distributed under the License is distributed on an "AS IS" BASIS,
20  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21  * See the License for the specific language governing permissions and
22  * limitations under the License.
23  */
24 
25 #ifndef SCG_UTILITIES_H_
26 #define SCG_UTILITIES_H_
27 
28 #include <string>
29 #include <vector>
30 #include "scg_glew.h"
31 #include <GLFW/glfw3.h>
32 
33 namespace scg {
34 
35 
39 const float PI = 3.141592654f;
40 
41 
49 int checkGLError();
50 
51 
60 bool isGLContextActive();
61 
62 
70 void getCursorPosPixels(GLFWwindow* window, double& xPixels, double& yPixels);
71 
72 
80 void setCursorPosPixels(GLFWwindow* window, double xPixels, double yPixels);
81 
82 
86 void formatFilePath(std::string& filePath);
87 
88 
96 std::string getFullFileName(const std::vector<std::string>& filePaths, const std::string& fileName);
97 
98 
102 void printUniformBlockInformation(GLuint program, int nMembers, const GLchar** uniformNames);
103 
104 
112 void splitFilePath(const std::string& filePath, std::vector<std::string>& splitPaths);
113 
114 
115 } /* namespace scg */
116 
117 #endif /* SCG_UTILITIES_H_ */
bool isGLContextActive()
Check if an active OpenGL context exists.
const float PI
Definition: scg_utilities.h:39
void setCursorPosPixels(GLFWwindow *window, double xPixels, double yPixels)
Set cursor (mouse pointer) position in pixels, as opposed to screen coordinates.
void formatFilePath(std::string &filePath)
Replace backslashes by slashes and ensure that the last character is a slash.
void splitFilePath(const std::string &filePath, std::vector< std::string > &splitPaths)
Split string containing one or more file paths into a vector of single paths.
void getCursorPosPixels(GLFWwindow *window, double &xPixels, double &yPixels)
Get cursor (mouse pointer) position in pixels, as opposed to screen coordinates.
Local header file for GLEW library.
int checkGLError()
Check if an OpenGL error has occured since last call of checkGLError().
Definition: Animation.h:28
void printUniformBlockInformation(GLuint program, int nMembers, const GLchar **uniformNames)
Print information about uniform blocks in shaders.
std::string getFullFileName(const std::vector< std::string > &filePaths, const std::string &fileName)
Try to find file name in a list of file paths.