|
GCOP
1.0
|
#include <viewer.h>

Public Member Functions | |
| Viewer () | |
| virtual | ~Viewer () |
| void | Init (int *argc, char **argv) |
| void | Start () |
| void | Add (View &view) |
| void | Remove (View &view) |
| void | RenderViews () |
| void | DrawOrigin (GLUquadricObj *qobj=0) |
| void | DrawAll () |
| void | SetColor (const float rgb[3]) |
| void | Reshape (int width, int height) |
| void | Render () |
| void | Keyboard (unsigned char ch, int x, int y) |
| void | Mouse (int button, int state, int x, int y) |
| void | Motion (int x, int y) |
| void | SaveImage (const char *name=0) |
| void | SetCamera (float sphi, float stheta, float sx, float sy, float sz) |
| void | SetCamera (const float params[5]) |
Static Public Member Functions | |
| static void | DrawFrame (GLUquadricObj *qobj=0) |
| static void | DrawArrow (double l=1.0, GLUquadricObj *qobj=0) |
| static void | DrawArrow (const double v[3], GLUquadricObj *qobj=0) |
| static void | DrawText (const char *str, float size=.2) |
| static GLuint | LoadTexture (const char *fname, int wrap=true) |
| static void | DrawCircle (double x=0, double y=0, double r=1, int slices=20) |
| static void | Cylinder (const double xa[3], const double xb[3], double r, int sd) |
| static void | SetColor (float r, float g, float b, float alpha=0) |
| static void | SetMaterial (GLfloat ambientR, GLfloat ambientG, GLfloat ambientB, GLfloat diffuseR, GLfloat diffuseG, GLfloat diffuseB, GLfloat specularR, GLfloat specularG, GLfloat specularB, GLfloat shininess) |
Public Attributes | |
| float | sphi |
| float | stheta |
| float | sx |
| float | sy |
| float | sz |
| float | zNear |
| float | zFar |
| float | aspect |
| float | xcam |
| float | ycam |
| int | width |
| int | height |
| float | os |
| origin scale (how long are the origin axes, default is 1) | |
| float | rgb [3] |
| default background (clear) color | |
| int | window |
| bool | animate |
| whether to animate all trajectory frames | |
| double | animDelay |
| animation delay (def. is 30 ms) | |
| bool | saveFrames |
| whether to save frame images | |
| const char * | frameName |
| frame image filename | |
| bool | saveDisplay |
| whether to continuously save display images at every refresh | |
| const char * | displayName |
| display image filename | |
| int | displayNo |
| counter for display image filenames | |
| bool | saveSnapshot |
| save a single snapshot | |
| bool | altLight |
Static Public Attributes | |
| static Viewer * | instance = 0 |
Protected Attributes | |
| int | downX |
| int | downY |
| int | leftButton |
| int | middleButton |
| int | rightButton |
| pthread_mutex_t | mut |
| std::map< int, View * > | views |
| GLUquadricObj * | aqobj |
| unsigned char * | rgbimg |
| rgb image used internally for saving | |
| unsigned char * | ppmimg |
| ppm image used internally for saving | |
Light-weight OpenGL viewer The viewer keeps a list of "views" of different objects and displays them. A view is simply defined as an object that "knows" how to be rendered: it provides its own Render() function
Author: Marin Kobilarov (mkobilar(at)robotics.usc.edu)
| Viewer::Viewer | ( | ) |
| Viewer::~Viewer | ( | ) | [virtual] |
| void Viewer::Add | ( | View & | view | ) |
Add a view
References gcop::View::id.
| void Viewer::Cylinder | ( | const double | xa[3], |
| const double | xb[3], | ||
| double | r, | ||
| int | sd | ||
| ) | [static] |
Draw a cylinder between two points
| xa | starting point |
| xb | end point |
| r | radius |
| sd | unused |
| void Viewer::DrawAll | ( | ) |
Draw all views and origin
| void Viewer::DrawArrow | ( | double | l = 1.0, |
| GLUquadricObj * | qobj = 0 |
||
| ) | [static] |
Draws an arrow with length l
| l | length of arrow |
| qobj | quadratic object used for drawing (leave 0 to create a new one) |
Referenced by gcop::Body2dView< c >::Render(), gcop::Body2dGraphView::RenderFrame(), gcop::Body3dTrackView::RenderFrame(), gcop::Body2dTrackView::RenderFrame(), and gcop::Kinbody3dTrackView< _nu >::RenderFrame().
| void Viewer::DrawArrow | ( | const double | v[3], |
| GLUquadricObj * | qobj = 0 |
||
| ) | [static] |
| void Viewer::DrawCircle | ( | double | x = 0, |
| double | y = 0, |
||
| double | r = 1, |
||
| int | slices = 20 |
||
| ) | [static] |
Draw a circle
| x | x-coord |
| y | y-coord |
| r | radius |
| slices | resolution in slices |
| void Viewer::DrawFrame | ( | GLUquadricObj * | qobj = 0 | ) | [static] |
Draw frame at the origin with unit length axes
| void Viewer::DrawOrigin | ( | GLUquadricObj * | qobj = 0 | ) |
Draw origin.
| void Viewer::DrawText | ( | const char * | str, |
| float | size = .2 |
||
| ) | [static] |
Draws text
| str | string |
| size | font size |
Referenced by gcop::Body2dGraphView::RenderFrame(), and gcop::Posegraph2dView::RenderFrame().
| void Viewer::Init | ( | int * | argc, |
| char ** | argv | ||
| ) |
Initialize the viewer with the command line args
References g_viewer_idle(), g_viewer_keyboard(), g_viewer_motion(), g_viewer_mouse(), g_viewer_render(), g_viewer_reshape(), and InitViewerWindow().
| void Viewer::Keyboard | ( | unsigned char | ch, |
| int | x, | ||
| int | y | ||
| ) |
| GLuint Viewer::LoadTexture | ( | const char * | fname, |
| int | wrap = true |
||
| ) | [static] |
Referenced by gcop::DemView::SetTexture().
| void Viewer::Motion | ( | int | x, |
| int | y | ||
| ) |
| void Viewer::Mouse | ( | int | button, |
| int | state, | ||
| int | x, | ||
| int | y | ||
| ) |
| void Viewer::Remove | ( | View & | view | ) |
Remove a view
References gcop::View::id.
| void Viewer::Render | ( | ) |
| void Viewer::RenderViews | ( | ) |
Render all views. This is automatically called by graphics engine. You can call this method only if you want to render the views immediately
References gcop::View::Lock(), gcop::View::Render(), gcop::View::RenderFrame(), and gcop::View::Unlock().
| void Viewer::Reshape | ( | int | width, |
| int | height | ||
| ) |
| void Viewer::SaveImage | ( | const char * | name = 0 | ) |
Save an image of the current display
| name | file name (if omited then the name will be "%s_%04d.ppm" where s is Viewer::frameName and i is a global index |
| void Viewer::SetCamera | ( | float | sphi, |
| float | stheta, | ||
| float | sx, | ||
| float | sy, | ||
| float | sz | ||
| ) |
| void Viewer::SetCamera | ( | const float | params[5] | ) |
| void Viewer::SetColor | ( | const float | rgb[3] | ) |
Set the default background (clear) color
| rgb | rgb color |
Referenced by gcop::UuvView< c >::Render(), gcop::Kinbody3dView< _nu >::Render(), gcop::Posegraph2dView::RenderFrame(), gcop::Body3dTrackView::RenderFrame(), gcop::Body2dTrackView::RenderFrame(), and gcop::Kinbody3dTrackView< _nu >::RenderFrame().
| void Viewer::SetColor | ( | float | r, |
| float | g, | ||
| float | b, | ||
| float | alpha = 0 |
||
| ) | [static] |
| void Viewer::SetMaterial | ( | GLfloat | ambientR, |
| GLfloat | ambientG, | ||
| GLfloat | ambientB, | ||
| GLfloat | diffuseR, | ||
| GLfloat | diffuseG, | ||
| GLfloat | diffuseB, | ||
| GLfloat | specularR, | ||
| GLfloat | specularG, | ||
| GLfloat | specularB, | ||
| GLfloat | shininess | ||
| ) | [static] |
Referenced by gcop::Normal2dView< _n >::Render().
| void Viewer::Start | ( | ) |
Start the viewer and loop until the program is killed NOTE: This should be done in the main process thread and not in a seperate thread!
whether to animate all trajectory frames
| double gcop::Viewer::animDelay |
animation delay (def. is 30 ms)
GLUquadricObj* gcop::Viewer::aqobj [protected] |
| float gcop::Viewer::aspect |
| const char* gcop::Viewer::displayName |
display image filename
counter for display image filenames
int gcop::Viewer::downX [protected] |
int gcop::Viewer::downY [protected] |
| const char* gcop::Viewer::frameName |
frame image filename
Viewer * Viewer::instance = 0 [static] |
int gcop::Viewer::leftButton [protected] |
int gcop::Viewer::middleButton [protected] |
pthread_mutex_t gcop::Viewer::mut [protected] |
| float gcop::Viewer::os |
origin scale (how long are the origin axes, default is 1)
unsigned char* gcop::Viewer::ppmimg [protected] |
ppm image used internally for saving
| float gcop::Viewer::rgb[3] |
default background (clear) color
unsigned char* gcop::Viewer::rgbimg [protected] |
rgb image used internally for saving
int gcop::Viewer::rightButton [protected] |
whether to continuously save display images at every refresh
whether to save frame images
save a single snapshot
| float gcop::Viewer::sphi |
| float gcop::Viewer::stheta |
| float gcop::Viewer::sx |
| float gcop::Viewer::sy |
| float gcop::Viewer::sz |
std::map<int, View*> gcop::Viewer::views [protected] |
| float gcop::Viewer::xcam |
| float gcop::Viewer::ycam |
| float gcop::Viewer::zFar |
| float gcop::Viewer::zNear |
1.7.6.1