World of Rigid Bodies (WoRB)
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Utilities.h File Reference

Declarations for various GLUT utilites for a rigid body application. More...

#include "WoRB.h"
#include <GL/freeglut.h>
Include dependency graph for Utilities.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

class  WoRB::GLUT_Renderer
 Interface for a GLUT-rendered rigid body. More...
struct  WoRB::GLUT_Renderer::Colorf
 Represents a color defined red, green, blue and alpha channels. More...
class  WoRB::GLTransform
 Establishes temporarily a GL transform from body-fixed into world frame. More...
class  WoRB::GLOrthoScreen
 Establishes temporarily orthogonal projection in screen coordinates. More...
class  WoRB::Ball
 Encapsulates a rigid body with geometry of a sphere. More...
class  WoRB::Box
 Encapsulates a rigid body with geometry of a rectangular parallelepiped. More...
class  WoRB::GLUT_Framework< GlutApplication >
 GLUT wrapper around a single instance of a GlutApplication template class. More...

Namespaces

namespace  WoRB

Defines

#define GLUT_DISABLE_ATEXIT_HACK
 Disable GLUT ataxit workaround on windows.

Functions

double WoRB::RandomReal ()
 Gets a uniform real number in range [0,1).
Quaternion WoRB::RandomQuaternion (double length=1.0)
 Gets a quaternion of the given length having a random orientation.
Quaternion WoRB::RandomQuaternion (const Quaternion &min, const Quaternion &max)
 Gets a random quaternion uniformly distributed in a 4D box.
void WoRB::RenderText (double x, double y, double z, const char *text)
 Renders the given text to the given location in body-fixed space.
int WoRB::RenderPrintf (int x, int y, const char *format,...)
 Renders the given text to the given location in screen space on the window.
void WoRB::RenderStateVariables (const RigidBody &body, const Quaternion &extent)
 Draws the geometry axes, angular velocity and angular momentum.
void WoRB::RenderAxes (double length)
 Draws the world axes.
void WoRB::Pause (unsigned long ms)
 Pauses execution for the given amount of milliseconds.
void WoRB::glutForegroundWindow ()
 Brings the current GLUT window to the foreground.

Detailed Description

Declarations for various GLUT utilites for a rigid body application.

Author:
Mikica B Kocic
Version:
0.2
Date:
2012-05-10

Definition in file Utilities.h.


Define Documentation

Disable GLUT ataxit workaround on windows.

Win32 has an annoying issue where there are multiple C run-time libraries (CRTs). If the executable is linked with a different CRT from the GLUT DLL, the GLUT DLL will not share the same CRT static data seen by the executable. In particular, atexit callbacks registered in the executable will not be called if GLUT calls its (different) exit routine). GLUT is typically built with the "/MD" option (the CRT with multithreading DLL support), but the Visual C++ linker default is "/ML" (the single threaded CRT).

One workaround to this issue is requiring users to always link with the same CRT as GLUT is compiled with. That requires users supply a non-standard option. GLUT 3.7 has its own built-in workaround where the executable's "exit" function pointer is covertly passed to GLUT. GLUT then calls the executable's exit function pointer to ensure that any "atexit" calls registered by the application are called if GLUT needs to exit.

To avoid the atexit workaround, define GLUT_DISABLE_ATEXIT_HACK.

Definition at line 39 of file Utilities.h.