JeVois
1.19
JeVois Smart Embedded Machine Vision Toolkit
Share this page:
Tweet
OpenGL.H
Go to the documentation of this file.
1
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2
//
3
// JeVois Smart Embedded Machine Vision Toolkit - Copyright (C) 2016 by Laurent Itti, the University of Southern
4
// California (USC), and iLab at USC. See http://iLab.usc.edu and http://jevois.org for information about this project.
5
//
6
// This file is part of the JeVois Smart Embedded Machine Vision Toolkit. This program is free software; you can
7
// redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software
8
// Foundation, version 2. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
10
// License for more details. You should have received a copy of the GNU General Public License along with this program;
11
// if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
12
//
13
// Contact information: Laurent Itti - 3641 Watt Way, HNB-07A - Los Angeles, CA 90089-2520 - USA.
14
// Tel: +1 213 740 3527 - itti@pollux.usc.edu - http://iLab.usc.edu - http://jevois.org
15
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
16
/*! \file */
17
18
#pragma once
19
20
#include <sstream>
21
#include <
jevois/Debug/Log.H
>
22
23
#ifdef JEVOIS_PLATFORM_PRO
24
#define EGL_EGLEXT_PROTOTYPES
25
#define GL_GLEXT_PROTOTYPES
26
#include <EGL/eglplatform.h>
27
#endif
28
29
// OpenGL-ES seems to be available both for platform and regular host PCs
30
#include <EGL/egl.h>
31
#include <EGL/eglext.h>
32
#include <GLES2/gl2.h>
33
#include <GLES2/gl2ext.h>
34
35
#ifdef JEVOIS_PRO
36
// JeVois Pro supports OpenGL-ES 3.2
37
#include <GLES3/gl3.h>
38
#include <GLES3/gl3ext.h>
39
#include <GLES3/gl31.h>
40
#include <GLES3/gl32.h>
41
#endif // JEVOIS_PRO
42
43
// On host, the above includes will pull in X11/X.h which defines some macros that conflict with our enums and/or with
44
// some definitions in Eigen. So here just nuke these:
45
#ifdef None
46
#undef None
47
#endif
48
49
#ifdef Success
50
#undef Success
51
#endif
52
53
#ifdef Status
54
#undef Status
55
#endif
56
57
namespace
jevois
58
{
59
//! Function to write OpenGL errors in clear witout requiring GLUT
60
inline
std::string
opengl_error
(
int
err)
61
{
62
switch
(err)
63
{
64
case
GL_INVALID_ENUM:
return
"GL_INVALID_ENUM"
;
65
case
GL_INVALID_VALUE:
return
"GL_INVALID_VALUE"
;
66
case
GL_INVALID_OPERATION:
return
"GL_INVALID_OPERATION"
;
67
case
GL_INVALID_FRAMEBUFFER_OPERATION:
return
"GL_INVALID_FRAMEBUFFER_OPERATION"
;
68
case
GL_OUT_OF_MEMORY:
return
"GL_OUT_OF_MEMORY"
;
69
default
: std::ostringstream ss; ss <<
"UNKNOWN(0x"
<< std::hex << err <<
'0'
;
return
ss.str();
70
}
71
}
72
}
// namespace jevois
73
74
//! Simple macro to check for OpenGL errors
75
/*! Inspired from here:
76
http://stackoverflow.com/questions/11256470/define-a-macro-to-facilitate-opengl-command-debugging */
77
#define GL_CHECK(stmt) do { stmt; GLenum _err = glGetError(); \
78
if (_err != GL_NO_ERROR) LFATAL("Error " << jevois::opengl_error(_err) <<" in: " << #stmt); } while (0)
79
80
//! Simple macro to check for OpenGL errors when a boolean result is expected
81
#define GL_CHECK_BOOL(stmt) do { int _result = stmt; if (_result == 0) LERROR("Failed: " #stmt); \
82
GLenum _err = glGetError(); \
83
if (_err != GL_NO_ERROR) LFATAL("Error " << jevois::opengl_error(_err) <<" in: " << #stmt); } while (0)
jevois
Definition:
Concepts.dox:1
Log.H
jevois::opengl_error
std::string opengl_error(int err)
Function to write OpenGL errors in clear witout requiring GLUT.
Definition:
OpenGL.H:60
include
jevois
GPU
OpenGL.H
Please help us improve this page: Edit it on
GitHub
or
email us your edits and suggestions.
Generated by
1.8.17