V-ARTContributions
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | List of all members
VART::ViewerGlutOGL Class Reference

V-ART Viewer that uses GLUT/OpenGL. More...

#include <viewerglutogl.h>

Classes

class  DrawHandler
 Draw handler. More...
 
class  IdleHandler
 Idle time handler. More...
 
class  KbHandler
 Keyboard handler. More...
 

Public Member Functions

 ViewerGlutOGL ()
 Creates an empty, unusable viewer positioned at (0,0). More...
 
 ViewerGlutOGL (int newWidth, int newHeight)
 Creates an empty, unusable viewer positioned at (0,0) of given size. More...
 
 ~ViewerGlutOGL ()
 
void SetScene (Scene &scene)
 Attaches a scene to the viewer. More...
 
void SetPosition (int x, int y)
 Changes the position of a viewer. More...
 
void SetKbHandler (KbHandler *ptrKbH)
 Add a keyboard handler to the viewer. More...
 
void SetIdleHandler (IdleHandler *newIHPtr)
 Sets the idle time handler. More...
 
void SetDrawHandler (DrawHandler *newDHPtr)
 Sets the drawing handler. More...
 
void SetCamera (Camera *camPtr)
 Sets the camera used to view the scene. More...
 
void SetClickHandler (MouseControl::ClickHandler *newCHPtr)
 Sets the mouse click handler. More...
 
void SetDragHandler (MouseControl::DragHandler *newDHPtr)
 Sets the mouse drag handler. More...
 
void SetMotionHandler (MouseControl::MotionHandler *newMHPtr)
 Sets the mouse motion handler. More...
 
void Idle ()
 Idle Management. More...
 
void SetSize (int newWidth, int newHeight)
 Sets the window size of the viewer. More...
 
int GetWidth ()
 Returns current window width. More...
 
int GetHeight ()
 Returns current window height. More...
 
const Camera * GetCurrentCamera () const
 Returns the current camera or NULL if no camera exists. More...
 
void Hide ()
 Hides the viewer. More...
 
void Show ()
 Shows the viewer. More...
 
void TurnIntoCurrentWindow ()
 Make the viewer become the current window. More...
 
void SetTitle (const std::string &newTitle)
 Changes window title. More...
 
void Iconify ()
 Iconifies (minimizes) the viewer window. More...
 
void PostRedisplay ()
 Marks the viewer window for redisplay. More...
 
void UseNextCamera ()
 Tells the scene to use next camera in its list. More...
 

Static Public Member Functions

static void MainLoop ()
 Enters main rendering loop. More...
 
static void Init (int *argcPtr, char *argv[])
 Initializes GLUT Library. More...
 
static void RedisplayAll ()
 Marks all viewers for redisplay. More...
 

Public Attributes

bool autoChangeCameraAspect
 
bool redrawOnIdle
 Sets whether the viewer should redraw at every Idle call. More...
 
float walkStep
 How much to walk at each step (mouse movement). More...
 
bool autoNavigationEnabled
 Sets whether the built-in navigation is enabled. This is set to "true" by default. More...
 
bool autoRespondKeys
 

Protected Member Functions

void ClearOGLBuffers ()
 Sets clear color and clears OpenGL buffers. More...
 

Detailed Description

V-ART Viewer that uses GLUT/OpenGL.

A ViewerGlutOGL is a window which can display a V-ART scene (VART::Scene) using GLUT and OpenGL. The window also has basic behavior such as mouse navigation and keyboard response. At most 6 instances of this class can be created.

Definition at line 41 of file viewerglutogl.h.

Constructor & Destructor Documentation

VART::ViewerGlutOGL::ViewerGlutOGL ( )

Creates an empty, unusable viewer positioned at (0,0).

Before using the viewer, a scene (with at least one object, one camera and one light) should be attached to it.

Definition at line 31 of file viewerglutogl.cpp.

VART::ViewerGlutOGL::ViewerGlutOGL ( int  newWidth,
int  newHeight 
)

Creates an empty, unusable viewer positioned at (0,0) of given size.

Before using the viewer, a scene (with at least one object, one camera and one light) should be attached to it.

Definition at line 39 of file viewerglutogl.cpp.

VART::ViewerGlutOGL::~ViewerGlutOGL ( )

Definition at line 71 of file viewerglutogl.cpp.

Member Function Documentation

void VART::ViewerGlutOGL::ClearOGLBuffers ( )
protected

Sets clear color and clears OpenGL buffers.

Definition at line 139 of file viewerglutogl.cpp.

const Camera* VART::ViewerGlutOGL::GetCurrentCamera ( ) const
inline

Returns the current camera or NULL if no camera exists.

Definition at line 176 of file viewerglutogl.h.

int VART::ViewerGlutOGL::GetHeight ( )
inline

Returns current window height.

Definition at line 173 of file viewerglutogl.h.

int VART::ViewerGlutOGL::GetWidth ( )
inline

Returns current window width.

Definition at line 171 of file viewerglutogl.h.

void VART::ViewerGlutOGL::Hide ( )

Hides the viewer.

Definition at line 1061 of file viewerglutogl.cpp.

void VART::ViewerGlutOGL::Iconify ( )

Iconifies (minimizes) the viewer window.

Definition at line 1086 of file viewerglutogl.cpp.

void VART::ViewerGlutOGL::Idle ( )

Idle Management.

Currently, handles mouse movment, updating the camera.

Definition at line 933 of file viewerglutogl.cpp.

References VART::MouseControl::CONTROL, and VART::MouseControl::LEFT.

void VART::ViewerGlutOGL::Init ( int *  argcPtr,
char *  argv[] 
)
static

Initializes GLUT Library.

Call this method before creation of the first viewer, passing the application arguments.

Definition at line 155 of file viewerglutogl.cpp.

void VART::ViewerGlutOGL::MainLoop ( )
static

Enters main rendering loop.

Draws (set them up) all lights in the scene and enters GLUT main loop. Never returns.

Definition at line 148 of file viewerglutogl.cpp.

void VART::ViewerGlutOGL::PostRedisplay ( )

Marks the viewer window for redisplay.

Definition at line 1094 of file viewerglutogl.cpp.

void VART::ViewerGlutOGL::RedisplayAll ( )
static

Marks all viewers for redisplay.

Definition at line 162 of file viewerglutogl.cpp.

References MAX_VIEWERS.

void VART::ViewerGlutOGL::SetCamera ( Camera *  camPtr)

Sets the camera used to view the scene.

Definition at line 1108 of file viewerglutogl.cpp.

void VART::ViewerGlutOGL::SetClickHandler ( MouseControl::ClickHandler newCHPtr)

Sets the mouse click handler.

Define a "click handler" if you want your application to receive mouse button events (button down/up).

Definition at line 1113 of file viewerglutogl.cpp.

void VART::ViewerGlutOGL::SetDragHandler ( MouseControl::DragHandler newDHPtr)

Sets the mouse drag handler.

Definition at line 1118 of file viewerglutogl.cpp.

void VART::ViewerGlutOGL::SetDrawHandler ( DrawHandler newDHPtr)

Sets the drawing handler.

Definition at line 118 of file viewerglutogl.cpp.

References VART::ViewerGlutOGL::DrawHandler::viewerPtr.

void VART::ViewerGlutOGL::SetIdleHandler ( IdleHandler newIHPtr)

Sets the idle time handler.

Definition at line 80 of file viewerglutogl.cpp.

References VART::ViewerGlutOGL::IdleHandler::viewerPtr.

void VART::ViewerGlutOGL::SetKbHandler ( KbHandler ptrKbH)

Add a keyboard handler to the viewer.

Definition at line 1102 of file viewerglutogl.cpp.

References VART::ViewerGlutOGL::KbHandler::viewerPtr.

void VART::ViewerGlutOGL::SetMotionHandler ( MouseControl::MotionHandler newMHPtr)

Sets the mouse motion handler.

Definition at line 1123 of file viewerglutogl.cpp.

void VART::ViewerGlutOGL::SetPosition ( int  x,
int  y 
)

Changes the position of a viewer.

Parameters
x[in] New left coordinate.
y[in] New top coordinate.

Definition at line 87 of file viewerglutogl.cpp.

void VART::ViewerGlutOGL::SetScene ( Scene &  scene)

Attaches a scene to the viewer.

Attachment is done by storing a pointer to the scene. The viewer itself will not change the scene, but it should handle a changing scene. Lighting is enabled if there are lights attached to the scene.

Definition at line 125 of file viewerglutogl.cpp.

void VART::ViewerGlutOGL::SetSize ( int  newWidth,
int  newHeight 
)

Sets the window size of the viewer.

Definition at line 95 of file viewerglutogl.cpp.

void VART::ViewerGlutOGL::SetTitle ( const std::string &  newTitle)

Changes window title.

Definition at line 1077 of file viewerglutogl.cpp.

void VART::ViewerGlutOGL::Show ( )

Shows the viewer.

Definition at line 1069 of file viewerglutogl.cpp.

void VART::ViewerGlutOGL::TurnIntoCurrentWindow ( )

Make the viewer become the current window.

Definition at line 113 of file viewerglutogl.cpp.

void VART::ViewerGlutOGL::UseNextCamera ( )
inline

Tells the scene to use next camera in its list.

Definition at line 197 of file viewerglutogl.h.

Member Data Documentation

bool VART::ViewerGlutOGL::autoChangeCameraAspect

Sets whether the aspect ratio of the viewer window should be passed along to its cameras.

Definition at line 219 of file viewerglutogl.h.

bool VART::ViewerGlutOGL::autoNavigationEnabled

Sets whether the built-in navigation is enabled. This is set to "true" by default.

Definition at line 231 of file viewerglutogl.h.

bool VART::ViewerGlutOGL::autoRespondKeys

Sets whether the built-in keyboard responses are enabled. This is set to "true" by default.

Definition at line 235 of file viewerglutogl.h.

bool VART::ViewerGlutOGL::redrawOnIdle

Sets whether the viewer should redraw at every Idle call.

This may usefull for simulations, where the scene is changing, to continuously redraw the scene.

Definition at line 225 of file viewerglutogl.h.

float VART::ViewerGlutOGL::walkStep

How much to walk at each step (mouse movement).

Definition at line 228 of file viewerglutogl.h.


The documentation for this class was generated from the following files: