Go to the documentation of this file.
16 #ifndef SURGSIM_TESTING_VISUALTESTCOMMON_GLUTRENDERER_H
17 #define SURGSIM_TESTING_VISUALTESTCOMMON_GLUTRENDERER_H
19 #include <Eigen/Geometry>
24 #include <GLUT/glut.h>
26 #define GLUT_NO_LIB_PRAGMA 1
135 explicit GlutImage(
const Eigen::AlignedBox<double, 2>& bounds) :
159 std::vector< std::shared_ptr<GlutRenderObject> >
children;
218 static void setCamera(std::shared_ptr<GlutCamera> camera)
225 static void addObject(std::shared_ptr<GlutRenderObject>
object)
239 static std::vector< std::shared_ptr<GlutRenderObject> >
m_objects;
245 static void reshape(GLint width, GLint height)
266 #endif // SURGSIM_TESTING_VISUALTESTCOMMON_GLUTRENDERER_H
static void display()
Glut display function which handles the drawing of the scene.
Definition: GlutRenderer.cpp:248
virtual void draw()=0
Pure virtual draw method for subclasses to define how to draw themselves with Glut.
GlutImage(const Eigen::AlignedBox< double, 2 > &bounds)
Constuctor.
Definition: GlutRenderer.h:135
Definitions of small fixed-size vector types.
SurgSim::DataStructures::Image< float > ImageType
Definition: GlutRenderer.h:128
double zNear
Near clipping plane distance from camera, in meters.
Definition: GlutRenderer.h:182
SurgSim::Math::Vector3d up
Up direction.
Definition: GlutRenderer.h:178
SurgSim::Math::Vector3d planeDirectionX
The unit direction along one of the pairs edges of the square.
Definition: GlutRenderer.h:56
Eigen::Transform< double, 3, Eigen::Isometry > RigidTransform3d
A 3D rigid (isometric) transform, represented as doubles.
Definition: RigidTransform.h:46
GlutCamera(const SurgSim::Math::Vector3d &eye_, const SurgSim::Math::Vector3d ¢er_, const SurgSim::Math::Vector3d &up_, const double fovY_, double zNear_, double zFar_)
Constructor.
Definition: GlutRenderer.h:193
static void run()
Initializes and runs the Glut main loop. This function will block until the Glut graphics window is c...
Definition: GlutRenderer.h:210
Axes with center at local origin, red axis along the local X-axis, green axis along the local Y-axis,...
Definition: GlutRenderer.h:84
static void initialize()
Initializes the Glut window.
Definition: GlutRenderer.cpp:223
virtual void draw()
Draws the group with Glut and iterates through its children to draw them.
Definition: GlutRenderer.cpp:207
std::vector< std::shared_ptr< GlutRenderObject > > children
Children of this group.
Definition: GlutRenderer.h:159
Abstract definition of an object that can render itself with Glut.
Definition: GlutRenderer.h:37
double length
Length of each axis, in meters.
Definition: GlutRenderer.h:86
Eigen::Matrix< double, 3, 1 > Vector3d
A 3D vector of doubles.
Definition: Vector.h:57
Definition: CompoundShapeToGraphics.cpp:30
An Image drawn to the screen.
Definition: GlutRenderer.h:127
Eigen::AlignedBox< double, 2 > m_bounds
Window coordinates to draw the image.
Definition: GlutRenderer.h:146
double radius
Radius of the sphere, in meters.
Definition: GlutRenderer.h:105
A simple thread-safe data container that can support multiple writers and readers.
Definition: LockedContainer.h:55
GlutGroup()
Constructor. The group is initialized with no children.
Definition: GlutRenderer.h:162
GLUquadric * quadratic
GLU quadric object for the quadric operations required to build the sphere.
Definition: GlutRenderer.h:122
double halfSize
One half of the edge length of the square, in meters.
Definition: GlutRenderer.h:60
double fovY
Field of view angle (in degrees) in the vertical direction.
Definition: GlutRenderer.h:180
SurgSim::Math::Vector3d color
Color of the sphere.
Definition: GlutRenderer.h:107
float width
Width of each axis, in pixels.
Definition: GlutRenderer.h:88
SurgSim::Framework::LockedContainer< ImageType > image
The image to draw.
Definition: GlutRenderer.h:131
Simple static class renderer built on Glut.
Definition: GlutRenderer.h:207
virtual void draw()
Draws the square with Glut.
Definition: GlutRenderer.cpp:36
SurgSim::Math::RigidTransform3d pose
Pose (rotation and translation) of the object.
Definition: GlutRenderer.h:39
double zFar
Far clipping plane distance from camera, in meters.
Definition: GlutRenderer.h:184
static void drawObjects()
Iterates through the scene objects to draw them.
Definition: GlutRenderer.h:256
static int m_width
Width of the window.
Definition: GlutRenderer.h:232
unsigned int m_texture
Texture used for holding the image.
Definition: GlutRenderer.h:149
SurgSim::Math::Vector3d color
Color of the square.
Definition: GlutRenderer.h:62
GlutSquare(double halfSize, const SurgSim::Math::Vector3d &color, const SurgSim::Math::Vector3d &planeDirectionX=SurgSim::Math::Vector3d(1.0, 0.0, 0.0), const SurgSim::Math::Vector3d &planeDirectionY=SurgSim::Math::Vector3d(0.0, 1.0, 0.0))
Constructor.
Definition: GlutRenderer.h:69
static std::vector< std::shared_ptr< GlutRenderObject > > m_objects
Objects in the scene.
Definition: GlutRenderer.h:239
virtual void draw()
Draws the sphere with Glut.
Definition: GlutRenderer.cpp:109
virtual void draw()
Draws the image with Glut.
Definition: GlutRenderer.cpp:127
Group of objects which provides a transform hierarchy.
Definition: GlutRenderer.h:157
SurgSim::Math::Vector3d planeDirectionY
The unit direction along the other pair of edges of the square.
Definition: GlutRenderer.h:58
virtual ~GlutRenderObject()
Definition: GlutRenderer.cpp:32
bool m_firstRun
Is this the fist run of draw.
Definition: GlutRenderer.h:152
Camera which controls the view of the scene.
Definition: GlutRenderer.h:172
SurgSim::Math::Vector3d eye
Eye position.
Definition: GlutRenderer.h:174
static void setCamera(std::shared_ptr< GlutCamera > camera)
Sets the camera used to control the view of the scene.
Definition: GlutRenderer.h:218
virtual void draw()
Draws the axes with Glut.
Definition: GlutRenderer.cpp:76
static int m_height
Height of the window.
Definition: GlutRenderer.h:234
SurgSim::Math::Vector3d center
Center (look at) position.
Definition: GlutRenderer.h:176
static std::shared_ptr< GlutCamera > m_camera
Camera which controls the view of the scene.
Definition: GlutRenderer.h:237
Sphere with center at local origin.
Definition: GlutRenderer.h:103
GlutSphere(double radius, const SurgSim::Math::Vector3d &color)
Constructor.
Definition: GlutRenderer.h:112
GlutRenderObject()
Constructor initializes pose as identity (no rotation or translation)
Definition: GlutRenderer.h:42
static void addObject(std::shared_ptr< GlutRenderObject > object)
Adds an object to the scene.
Definition: GlutRenderer.h:225
GlutAxes(double length, float width)
Constructor.
Definition: GlutRenderer.h:93
A templated Image class.
Definition: Image.h:34
static void reshape(GLint width, GLint height)
Glut reshape function which handles the resizing of the window.
Definition: GlutRenderer.h:245
Square with center at local origin.
Definition: GlutRenderer.h:54