VAPOR3 3.9.4
glutil.h
Go to the documentation of this file.
1//************************************************************************
2// *
3// Copyright (C) 2004 *
4// University Corporation for Atmospheric Research *
5// All Rights Reserved *
6// *
7//************************************************************************/
8//
9// File: glutil.h
10//
11// Adaptor: Alan Norton
12// National Center for Atmospheric Research
13// PO 3000, Boulder, Colorado
14//
15// Date: July 2004
16//
17// Description: Methods to facilitate use of trackball navigation,
18// adapted from Ken Purcell's code to work in QT window
19//
20// Copyright (C) 1992 AHPCRC, Univeristy of Minnesota
21//
22// This program is free software; you can redistribute it and/or modify
23// it under the terms of the GNU General Public License as published by
24// the Free Software Foundation; either version 2 of the License, or
25// (at your option) any later version.
26//
27// This program is distributed in the hope that it will be useful,
28// but WITHOUT ANY WARRANTY; without even the implied warranty of
29// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30// GNU General Public License for more details.
31//
32// You should have received a copy of the GNU General Public License
33// along with this program in a file named 'Copying'; if not, write to
34// the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139.
35//
36
37// Original Author:
38// Ken Chin-Purcell (ken@ahpcrc.umn.edu)
39// Army High Performance Computing Research Center (AHPCRC)
40// Univeristy of Minnesota
41//
42
43#ifndef _glutil_h_
44#define _glutil_h_
45
46#ifdef __APPLE__
47 #define GL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED
48#endif
49
50#include <vapor/GLInclude.h>
51#include <cmath>
52#include <vector>
53#include <string>
54#include <vapor/common.h>
55
56/* These vector and quaternion macros complement similar
57 * routines.
58 */
59
60#ifdef ArchLinux
61 #define sqrtf(fval) ((float)sqrt((double)(fval)))
62 #define fabsf(fval) ((float)fabs((double)(fval)))
63 #define sinf(fval) ((float)sin((double)(fval)))
64 #define cosf(fval) ((float)cos((double)(fval)))
65 #define tanf(fval) ((float)tan((double)(fval)))
66#endif
67
68//#define vset(a,x,y,z) (a[0] = x, a[1] = y, a[2] = z)
69//#define Verify(expr,estr) if (!(expr)) BailOut(estr,__FILE__,__LINE__)
70
71#define CallocType(type, i) (type *)calloc(i, sizeof(type))
72
73#define YMAXSTEREO 491
74#define YOFFSET 532
75#ifndef M_PI
76 #define M_PI 3.14159265358979323846
77#endif
78/*extern GLfloat *idmatrix;*/
79
80namespace VAPoR {
81
82/* glutil.c */
83
84RENDER_API int __CheckGLError(const char *file, int line, const char *msg = 0);
85
92//
93RENDER_API bool oglStatusOK(std::vector<int> &status);
94
95RENDER_API void doubleToString(const double val, std::string &result, int digits);
100//
101RENDER_API std::string oglGetErrMsg(std::vector<int> status);
102
106
110}; // namespace VAPoR
111
112#define CheckGLError() __CheckGLError(__FILE__, __LINE__)
113#define CheckGLErrorMsg(msg) __CheckGLError(__FILE__, __LINE__, msg)
114
115#ifndef NDEBUG
116 #ifdef Darwin
117 #define GL_LEGACY(x) \
118 { \
119 }
120 #else
121 #define GL_LEGACY(x) x
122 #endif
123 #include <signal.h>
124 #define GL_ERR_BREAK() \
125 if (CheckGLError()) ::raise(SIGTERM)
126#else
127 #define GL_LEGACY(x)
128 #define GL_ERR_BREAK()
129#endif
130
131#endif // _glutil_h_
#define RENDER_API
Definition: common.h:78
RENDER_API std::string oglGetErrMsg(std::vector< int > status)
RENDER_API int oglGetFreeMemory()
RENDER_API void doubleToString(const double val, std::string &result, int digits)
RENDER_API bool oglStatusOK(std::vector< int > &status)
RENDER_API bool FrameBufferReady()
RENDER_API int __CheckGLError(const char *file, int line, const char *msg=0)