src
rviz
ogre_helpers
render_system.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2011, Willow Garage, Inc.
3
* All rights reserved.
4
*
5
* Redistribution and use in source and binary forms, with or without
6
* modification, are permitted provided that the following conditions are met:
7
*
8
* * Redistributions of source code must retain the above copyright
9
* notice, this list of conditions and the following disclaimer.
10
* * Redistributions in binary form must reproduce the above copyright
11
* notice, this list of conditions and the following disclaimer in the
12
* documentation and/or other materials provided with the distribution.
13
* * Neither the name of the Willow Garage, Inc. nor the names of its
14
* contributors may be used to endorse or promote products derived from
15
* this software without specific prior written permission.
16
*
17
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27
* POSSIBILITY OF SUCH DAMAGE.
28
*/
29
#ifndef RENDER_SYSTEM_H
30
#define RENDER_SYSTEM_H
31
32
#include <OgreRoot.h>
33
#include <stdint.h>
34
35
#include <rviz/rviz_export.h>
36
37
namespace
Ogre
38
{
39
class
OverlaySystem;
40
class
SceneManager;
41
}
// namespace Ogre
42
43
namespace
rviz
44
{
45
class
RVIZ_EXPORT
RenderSystem
46
{
47
public
:
48
#if defined(Q_OS_MAC) || defined(Q_OS_WIN)
49
typedef
size_t
WindowIDType
;
50
#else
51
typedef
unsigned
long
WindowIDType
;
52
#endif
53
54
static
RenderSystem
*
get
();
55
56
Ogre::RenderWindow* makeRenderWindow(
WindowIDType
window_id,
57
unsigned
int
width,
58
unsigned
int
height,
59
double
pixel_ratio = 1.0);
60
61
Ogre::Root*
root
()
62
{
63
return
ogre_root_;
64
}
65
66
// Prepare a scene_manager to render overlays.
67
// Needed for Ogre >= 1.9 to use fonts; does nothing for prior versions.
68
void
prepareOverlays(Ogre::SceneManager* scene_manager);
69
70
// @brief return OpenGl Version as integer, e.g. 320 for OpenGl 3.20
71
int
getGlVersion
()
72
{
73
return
gl_version_;
74
}
75
76
// @brief return GLSL Version as integer, e.g. 150 for GLSL 1.50
77
int
getGlslVersion
()
78
{
79
return
glsl_version_;
80
}
81
82
// @brief Disables the use of Anti Aliasing
83
static
void
disableAntiAliasing();
84
85
// @brief Force to use the provided OpenGL version on startup
86
static
void
forceGlVersion(
int
version);
87
88
// @brief Disable stereo rendering even if supported in HW.
89
static
void
forceNoStereo();
90
91
// @brief True if we can render stereo on this device.
92
bool
isStereoSupported
()
93
{
94
return
stereo_supported_;
95
}
96
97
private
:
98
RenderSystem
();
99
void
setupDummyWindowId();
100
void
loadOgrePlugins();
101
102
// helper for makeRenderWindow()
103
Ogre::RenderWindow* tryMakeRenderWindow(
const
std::string& name,
104
unsigned
int
width,
105
unsigned
int
height,
106
const
Ogre::NameValuePairList* params,
107
int
max_attempts);
108
109
// Find and configure the render system.
110
void
setupRenderSystem();
111
void
setupResources();
112
void
detectGlVersion();
113
114
static
RenderSystem
*
instance_
;
115
116
// ID for a dummy window of size 1x1, used to keep Ogre happy.
117
WindowIDType
dummy_window_id_
;
118
119
Ogre::Root*
ogre_root_
;
120
Ogre::OverlaySystem*
ogre_overlay_system_
;
121
122
int
gl_version_
;
123
int
glsl_version_
;
124
static
bool
use_anti_aliasing_
;
125
static
int
force_gl_version_
;
126
bool
stereo_supported_
;
127
static
bool
force_no_stereo_
;
128
};
129
130
}
// end namespace rviz
131
132
#endif // RENDER_SYSTEM_H
rviz::RenderSystem::glsl_version_
int glsl_version_
Definition:
render_system.h:123
rviz::RenderSystem::use_anti_aliasing_
static bool use_anti_aliasing_
Definition:
render_system.h:124
Ogre
Definition:
axes_display.h:35
rviz::RenderSystem::force_gl_version_
static int force_gl_version_
Definition:
render_system.h:125
rviz::RenderSystem::stereo_supported_
bool stereo_supported_
Definition:
render_system.h:126
rviz::RenderSystem::isStereoSupported
bool isStereoSupported()
Definition:
render_system.h:92
rviz::RenderSystem::ogre_root_
Ogre::Root * ogre_root_
Definition:
render_system.h:119
get
def get(url)
rviz::RenderSystem::WindowIDType
unsigned long WindowIDType
Definition:
render_system.h:51
rviz::RenderSystem::ogre_overlay_system_
Ogre::OverlaySystem * ogre_overlay_system_
Definition:
render_system.h:120
rviz
Definition:
add_display_dialog.cpp:54
rviz::RenderSystem::force_no_stereo_
static bool force_no_stereo_
Definition:
render_system.h:127
rviz::RenderSystem
Definition:
render_system.h:45
rviz::RenderSystem::dummy_window_id_
WindowIDType dummy_window_id_
Definition:
render_system.h:117
rviz::RenderSystem::root
Ogre::Root * root()
Definition:
render_system.h:61
rviz::RenderSystem::getGlslVersion
int getGlslVersion()
Definition:
render_system.h:77
rviz::RenderSystem::instance_
static RenderSystem * instance_
Definition:
render_system.h:114
rviz::RenderSystem::getGlVersion
int getGlVersion()
Definition:
render_system.h:71
rviz::RenderSystem::gl_version_
int gl_version_
Definition:
render_system.h:122
rviz
Author(s): Dave Hershberger, David Gossow, Josh Faust, William Woodall
autogenerated on Fri Aug 2 2024 08:43:10