GL Studio C++ Runtime API
RuntimeDisplayFrame Class Reference

#include <runtime_display_frame.h>

Inheritance diagram for RuntimeDisplayFrame:
DisplayFrame GlsPainter AttributeChangedNotifier WeakReferenceableMixin WeakReferenceable EmbeddedDisplayFrame glsDisplayFrame

Public Member Functions

 RuntimeDisplayFrame (const char *name, int width, int height)
 
virtual ~RuntimeDisplayFrame ()
 
virtual void Clear ()
 
virtual GlsEyePointCurrentEyePoint ()
 
virtual void CurrentEyePoint (GlsEyePoint *eye)
 
virtual void Scale (float scale)
 
virtual float Scale () override
 
virtual DisplayObjecthandle (DisplayEvent *ev)
 
virtual void BackgroundColor (unsigned char r, unsigned char g, unsigned char b, unsigned char a)
 
virtual void GetBackgroundColor (unsigned char &r, unsigned char &g, unsigned char &b, unsigned char &a)
 
virtual void BackgroundColor (const GlsColor &color)
 
const char * Name ()
 
void Name (char *name)
 
virtual GlsColor BackgroundColor ()
 
virtual int FrameInterval ()
 
virtual void FrameInterval (int interval)
 
virtual StatisticsStats ()
 
virtual void RecordCalculateStart ()
 
virtual void RecordCalculateEnd ()
 
virtual void ClearDragAndFocus () override
 
virtual bool UpdateAnimate ()
 
virtual bool FrameAnimate ()
 
virtual void WaitForNextFrame ()
 
virtual void Paint ()
 
virtual void WidthOffset (float offset)
 
virtual float WidthOffset ()
 
virtual void HeightOffset (float offset)
 
virtual float HeightOffset ()
 
virtual void DepthFactor (float factor)
 
virtual float DepthFactor ()
 
virtual void FOV (double fov)
 
virtual double FOV ()
 
virtual void CurrentView (const int view)
 
virtual int CurrentView () const
 
void Invalidate () override
 Notify the painter that the scene needs to be redrawn. More...
 
bool IsInvalidated () const override
 
- Public Member Functions inherited from DisplayFrame
 DisplayFrame (int width, int height, bool allocateObjects=true)
 
void ClearBitfield (GLbitfield bitField)
 
GLbitfield ClearBitfield ()
 
virtual void DragObject (DisplayObject *obj)
 
virtual DisplayObjectDragObject ()
 
virtual void ClearDrag ()
 
virtual void FocusObject (DisplayObject *obj)
 
virtual DisplayObjectFocusObject ()
 
virtual void ClearFocus ()
 
virtual void MultitouchEnabled (bool enabled)
 
virtual bool MultitouchEnabled ()
 
virtual InputHandlerGetInputHandler ()
 
virtual DisplayObjectHandleDisplayEvent (DisplayEvent *ev)
 
virtual void WriteResources (const char *filename, GlsResourceFilter *filter=NULL)
 
virtual void ReadResources (const char *filename)
 
virtual DistiAttributeBaseResource (const char *name)
 
virtual void GetResources (std::ostream &outstr, GlsResourceFilter *filter=NULL)
 
virtual void SetResources (std::istream &instr)
 
void SetResource (const std::string &resourceName, const std::string &resourceVal)
 
void SetResource (const char *resourceName, const char *resourceVal)
 
std::string GetResource (const std::string &resourceName)
 
std::string GetResource (const char *resourceName)
 
virtual char * GetResource_CRTClean (const char *name)
 
virtual void GetResourceFree_CRTClean (char *memoryToFree)
 
virtual char * GetResources_CRTClean (GlsResourceFilter *filter)
 
virtual void GetResourcesFree_CRTClean (char *memoryToFree)
 
virtual void SetResource_CRTClean (const char *name, const char *value)
 
virtual void SetResources_CRTClean (const char *buf)
 
virtual void NotifyAttributeChanged (const AttributeName &name) override
 
virtual InterfaceListTypeGetCppInterfaceDescription (InterfaceListType *addToThisList=NULL)
 
virtual void GetCppInterfaceDescriptionFree (InterfaceListType *array)
 
void SetTexturePaletteSize (int cnt)
 
void Draw ()
 
void InsertObject (DisplayObject *obj, bool reparent=true, bool recalculateBoundingbox=true, int loc=-1)
 
void InsertObject (DisplayObject *obj, int loc)
 
void PushObject (DisplayObject *obj)
 
int Width ()
 
int Height ()
 
void SetWidth (int w)
 
void SetHeight (int h)
 
virtual void SetRedraw ()
 
bool CullingEnabled ()
 
void CullingEnabled (const bool enabled)
 
DistiAttribDictFrameAttribDict ()
 
const DistiAttribDictFrameAttribDict () const
 
DynamicMaterialArrayMaterialPalette ()
 
ComponentLightMgrLightMgr ()
 
void LightMgr (ComponentLightMgr *val)
 
virtual void ClearDragAndFocus ()
 
- Public Member Functions inherited from AttributeChangedNotifier
virtual void NotifyAttributeChanged (const AttributeName &name)=0
 
virtual ~AttributeChangedNotifier ()
 
- Public Member Functions inherited from WeakReferenceableMixin
void AddWeakReference (WeakReference *weakRef) override
 
void NotifyWeakReferenceDestroyed (WeakReference *ref) override
 
virtual void AddWeakReference (WeakReference *weakRef)=0
 
virtual void NotifyWeakReferenceDestroyed (WeakReference *weakReference)=0
 
virtual void Invalidate ()=0
 Notify the painter that the scene needs to be redrawn. More...
 
virtual bool IsInvalidated () const =0
 

Public Attributes

GlsColor _backgroundColor
 
- Public Attributes inherited from DisplayFrame
TexturePalettetexturePalette
 
SoundSystem_sound_player
 
Groupobjects
 

Protected Attributes

Timer _frameTimer
 Timer used for scheduling.
 
TimerframeTimer
 For backwards compatibility.
 
float _smoothedFrameDelay
 Frame interval, smoothed based on actual draw performance.
 
float _width_offset
 For better control over clipping and field of view, use a GlsEyePoint, but some limited functionality is available here. More...
 
float _height_offset
 Current "height" offset of window. Used for panning of display vertically in ortho mode.
 
Vector _viewOffset
 Additional offset to apply to the modelview matrix.
 
float _depthFactor
 Used for auto calculations.
 
double _fov
 Field Of View. If 0.0 (the default), fov will be auto calculated.
 
double _nearZ
 Near clipping plane. Only meaningful if _autoCalcNearZ is false.
 
bool _autoCalcNearZ
 When true a _nearZ is automatically calculated.
 
double _farZ
 Far clipping plane. Only meaningfull if _autoCalcVarZ is false.
 
bool _autoCalcFarZ
 When true a _farZ is automatically calculated.
 
int _current_view
 Current view of the canvas (e.g., ortho, perspective, eyepoint).
 
std::string _name
 The title of this display frame's window, if applicable.
 
float _scale
 Scale of the window.
 
unsigned int frameInterval
 The frame interval in microSeconds (inverse of frame rate).
 
GlsEyePoint_currentEyePoint
 The current eyepoint for viewing the scene.
 
bool _redraw
 Flag indicating if the window should be redrawn.
 
- Protected Attributes inherited from DisplayFrame
bool _cullingEnabled
 
int _width
 
int _height
 
float _lastPickedDepth
 
DynamicMaterialArray _materialPalette
 
ComponentLightMgr_lightMgr
 
GLbitfield _clearBitfield
 
std::string _componentHeaderFileName
 
DragObjectMap * _dragObjectMap
 Holds a focus object for each cursor.
 
unsigned int _currentCursor
 
bool _multitouchEnabled
 
unsigned int _cursorsDown
 
- Protected Attributes inherited from WeakReferenceableMixin
DynamicArray< WeakReference * > * _weakRefs
 

Additional Inherited Members

- Static Public Member Functions inherited from DisplayFrame
static void SetOpenGLDefaultState (bool saveVal)
 
static void RestoreOpenGLState ()
 
- Protected Member Functions inherited from DisplayFrame
virtual void CurrentCursor (unsigned int cursor_id)
 
void CleanupDragMap ()
 
DisplayObjectGetDragObjectForCursor (unsigned int cursorID)
 
DisplayObjectFindDragObject ()
 
virtual EventCompressor< DisplayFrame > * GetEventCompressor ()
 
virtual float Scale ()
 
- Protected Member Functions inherited from WeakReferenceableMixin
 WeakReferenceableMixin ()
 
virtual ~WeakReferenceableMixin ()
 

Detailed Description

Provides basic support for runtime display frames

Constructor & Destructor Documentation

◆ RuntimeDisplayFrame()

RuntimeDisplayFrame ( const char *  name,
int  width,
int  height 
)

Ctor for RuntimeDisplayFrame

Parameters
nameThe title of the display frame. Shown in the window title bar.
widthThe width of the display frame window, in pixels.
heightThe height of the display frame window, in pixels.

◆ ~RuntimeDisplayFrame()

virtual ~RuntimeDisplayFrame ( )
virtual

Member Function Documentation

◆ BackgroundColor() [1/3]

virtual GlsColor BackgroundColor ( )
virtual

Gets the background color of the window to the given value

Returns
The background color

◆ BackgroundColor() [2/3]

virtual void BackgroundColor ( const GlsColor color)
virtual

Sets the background color of the window to the given value

Parameters
colorThe new color

◆ BackgroundColor() [3/3]

virtual void BackgroundColor ( unsigned char  r,
unsigned char  g,
unsigned char  b,
unsigned char  a 
)
virtual

Sets the background color of the window to the given value

Parameters
rNew red color (0-255 range)
gNew green color (0-255 range)
bNew blue color (0-255 range)
aNew alpha color (0-255 range)

◆ Clear()

virtual void Clear ( )
virtual

Clears the window associated with the display frame. The current _clearBitfield is used

◆ ClearDragAndFocus()

virtual void ClearDragAndFocus ( )
overridevirtual

Call this before deleting objects which may be being kept by the drag or focus objects

Reimplemented from DisplayFrame.

◆ CurrentEyePoint() [1/2]

virtual GlsEyePoint * CurrentEyePoint ( )
virtual
Returns
The current eyepoint for the display frame

◆ CurrentEyePoint() [2/2]

virtual void CurrentEyePoint ( GlsEyePoint eye)
virtual

Sets the current eyepoint for the display frame.

Parameters
eyeThe eyepoint to use for the display frame.

◆ CurrentView() [1/2]

virtual int CurrentView ( ) const
inlinevirtual

Gets the current view mode for the window.

Returns
The current viewmode for the window (VIEW_EYEPOINT, VIEW_XY, VIEW_PERSPECTIVE)

◆ CurrentView() [2/2]

virtual void CurrentView ( const int  view)
inlinevirtual

Sets the current view mode for the window

Parameters
viewThe new view mode for the window.
Acceptable view types are: [VIEW_EYEPOINT - The application will be viewed through an eyepoint] [VIEW_XY - The application will be viewed through a 2D orthographic view of the XY plane] [VIEW_PERSPECTIVE - The application will be viewed through a perspective projection]

◆ DepthFactor() [1/2]

virtual float DepthFactor ( )
virtual

Gets the Depth Factor for the window

Returns
The current depth factor

◆ DepthFactor() [2/2]

virtual void DepthFactor ( float  factor)
virtual

Sets the Depth Factor for the window

Parameters
factorThe depth factor. Used for autocalculating clipping planes

◆ FOV() [1/2]

virtual double FOV ( )
virtual

Gets the FOV (Field of View) for the window.

Returns
The current field of view in degrees

◆ FOV() [2/2]

virtual void FOV ( double  fov)
virtual

Sets the FOV (Field of View) for the window. If fov is set to 0.0, a reasonable FOV will be calculated based on width and height.

Parameters
fovNew field of view in degrees

◆ FrameAnimate()

virtual bool FrameAnimate ( )
virtual

Redraw the window at the Hz rate set for the DisplayFrame, or at least try to. We might be slower if the hardware can't keep up.

Returns
on desktop runtimes, returns true if any window is still open. On ES runtimes always returns true.

Reimplemented in glsDisplayFrame.

◆ FrameInterval() [1/2]

virtual int FrameInterval ( )
virtual

Returns the Frame Interval in microseconds

Returns
The Frame Interval in microseconds

◆ FrameInterval() [2/2]

virtual void FrameInterval ( int  interval)
virtual

Sets the target Frame Interval in microseconds

Parameters
intervalThe frame interval in microseconds

◆ GetBackgroundColor()

virtual void GetBackgroundColor ( unsigned char &  r,
unsigned char &  g,
unsigned char &  b,
unsigned char &  a 
)
virtual

Gets the background color of the window to the given value

Parameters
rGets red color (0-255 range)
gGets green color (0-255 range)
bGets blue color (0-255 range)
aGets alpha color (0-255 range)

◆ handle()

virtual DisplayObject * handle ( DisplayEvent ev)
virtual

Handles keyboard and mouse events and dispatches them to the display objects.

Parameters
evA display event
Returns
Pointer to the object that handled the event or NULL if no object handled it.

◆ HeightOffset() [1/2]

virtual float HeightOffset ( )
virtual

Gets the vertical position of the display at the center of the window

Returns
The Y position at the center of the window

◆ HeightOffset() [2/2]

virtual void HeightOffset ( float  offset)
virtual

Pans the display vertically

Parameters
offsetThe new Y position of the center of the window

◆ Invalidate()

void Invalidate ( )
overridevirtual

Notify the painter that the scene needs to be redrawn.

Implements GlsPainter.

◆ IsInvalidated()

bool IsInvalidated ( ) const
overridevirtual
Returns
Whether or not the painter has already been invalidated.

Implements GlsPainter.

◆ Name() [1/2]

const char * Name ( )

Gets the title(name) of this display frame

Returns
The name of this display frame

◆ Name() [2/2]

void Name ( char *  name)

Sets the name(title) for this display frame

Parameters
nameThe new title for the display frame

◆ Paint()

virtual void Paint ( )
inlinevirtual

Redraws the window, using the platform specific mechanism. Place holder for base class implementations. Simple implementations may draw directly, while implementations that use a window manager may tell the window manager to redraw.

Reimplemented in EmbeddedDisplayFrame, and glsDisplayFrame.

◆ RecordCalculateEnd()

virtual void RecordCalculateEnd ( )
virtual

Part of display frame statistics, for recording time used in Calculate()

◆ RecordCalculateStart()

virtual void RecordCalculateStart ( )
virtual

Part of display frame statistics, for recording time used in Calculate()

◆ Scale() [1/2]

virtual float Scale ( )
overridevirtual
Returns
The current scale for the display frame

Reimplemented from DisplayFrame.

◆ Scale() [2/2]

virtual void Scale ( float  scale)
virtual

Set the scale for the display frame.

Parameters
scaleThe new scale factor. Must be non-zero. A value of zero will be ignored.

◆ Stats()

virtual Statistics * Stats ( )
virtual

Creates and returns a pointer to a statistics object

Returns
A pointer to the statistics object

◆ UpdateAnimate()

virtual bool UpdateAnimate ( )
virtual

Redraws the scene if the scene has changed since the last frame, and also calls WaitForNextFrame to ensure we are not drawing faster than the set frame interval allows.

Returns
true if we the scene was redrawn. Generally used to determine if the buffers need to be swapped

◆ WaitForNextFrame()

virtual void WaitForNextFrame ( )
virtual

Sleeps based on the Hz rate set for the DisplayFrame.

◆ WidthOffset() [1/2]

virtual float WidthOffset ( )
virtual

Gets the horizontal position of the display at the center of the window

Returns
The X position at the center of the window

◆ WidthOffset() [2/2]

virtual void WidthOffset ( float  offset)
virtual

Pans the display horizontally

Parameters
offsetThe new X position at the center of the window

Member Data Documentation

◆ _backgroundColor

GlsColor _backgroundColor

The background clear color

◆ _width_offset

float _width_offset
protected

For better control over clipping and field of view, use a GlsEyePoint, but some limited functionality is available here.

Current "width" offset of window. Used for panning of display horizontally in ortho mode.


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