Jetson Inference
DNN Vision Library
glDisplay Class Reference

OpenGL display window and image/video renderer with CUDA interoperability. More...

#include <glDisplay.h>

Inheritance diagram for glDisplay:
videoOutput

Classes

struct  eventHandler
 

Public Member Functions

 ~glDisplay ()
 Destroy window. More...
 
virtual bool Open ()
 Open the window. More...
 
bool IsOpen () const
 Returns true if the window is open. More...
 
bool IsClosed () const
 Returns true if the window has been closed. More...
 
bool IsRendering () const
 Returns true if between BeginRender() and EndRender() More...
 
float GetFPS () const
 Get the average frame time (in milliseconds). More...
 
uint32_t GetID () const
 Get the ID of this display instance into glGetDisplay() More...
 
virtual uint32_t GetType () const
 Return the interface type (glDisplay::Type) More...
 
Frame Begin + End
void BeginRender (bool processEvents=true)
 Clear window and begin rendering a frame. More...
 
void EndRender ()
 Finish rendering and refresh / flip the backbuffer. More...
 
Image Rendering
void Render (glTexture *texture, float x=5.0f, float y=30.0f)
 Render an OpenGL texture. More...
 
void Render (float *image, uint32_t width, uint32_t height, float x=0.0f, float y=30.0f, bool normalize=true)
 Render a CUDA float4 image using OpenGL interop If normalize is true, the image's pixel values will be rescaled from the range of [0-255] to [0-1] If normalize is false, the image's pixel values are assumed to already be in the range of [0-1] Note that if normalization is selected to be performed, it will be done in-place on the image. More...
 
template<typename T >
bool Render (T *image, uint32_t width, uint32_t height)
 Render a CUDA image (uchar3, uchar4, float3, float4) using OpenGL interop. More...
 
virtual bool Render (void *image, uint32_t width, uint32_t height, imageFormat format)
 Render a CUDA image (uchar3, uchar4, float3, float4) using OpenGL interop. More...
 
void RenderImage (void *image, uint32_t width, uint32_t height, imageFormat format, float x=0.0f, float y=30.0f, bool normalize=true)
 Render a CUDA image (uchar3, uchar4, float3, float4) using OpenGL interop. More...
 
void RenderOnce (void *image, uint32_t width, uint32_t height, imageFormat format, float x=5.0f, float y=30.0f, bool normalize=true)
 Begin the frame, render one CUDA image using OpenGL interop, and end the frame. More...
 
void RenderOnce (float *image, uint32_t width, uint32_t height, float x=5.0f, float y=30.0f, bool normalize=true)
 Begin the frame, render one CUDA float4 image using OpenGL interop, and end the frame. More...
 
Vector Rendering
void RenderLine (float x1, float y1, float x2, float y2, float r, float g, float b, float a=1.0f, float thickness=2.0f)
 Render a line in screen coordinates with the specified color. More...
 
void RenderOutline (float x, float y, float width, float height, float r, float g, float b, float a=1.0f, float thickness=2.0f)
 Render the outline of a rect in screen coordinates with the specified color. More...
 
void RenderRect (float x, float y, float width, float height, float r, float g, float b, float a=1.0f)
 Render a filled rect in screen coordinates with the specified color. More...
 
void RenderRect (float r, float g, float b, float a=1.0f)
 Render a filled rect covering the current viewport with the specified color. More...
 
Window Resizing
void SetSize (uint32_t width, uint32_t height)
 Set the window's size. More...
 
void SetMaximized (bool maximized)
 Maximize or un-maximize the window. More...
 
bool IsMaximized ()
 Determine if the window is maximized or not. More...
 
void SetFullscreen (bool fullscreen)
 Set the window to fullscreen mode or not. More...
 
bool IsFullscreen ()
 Determine if the window is fullscreen or not. More...
 
Viewport Options
void GetBackgroundColor (float *r, float *g, float *b, float *a=NULL)
 Retrieve the window's background color. More...
 
void SetBackgroundColor (float r, float g, float b, float a=1.0f)
 Set the window's background color. More...
 
void SetViewport (int left, int top, int right, int bottom)
 Set the active viewport being rendered to. More...
 
void ResetViewport ()
 Reset to the full viewport (and change back GL_PROJECTION) More...
 
Event Handling
void ProcessEvents ()
 Process UI event messages. More...
 
void AddEventHandler (glEventHandler callback, void *user=NULL)
 Register an event message handler that will be called by ProcessEvents() More...
 
void RemoveEventHandler (glEventHandler callback, void *user=NULL)
 Remove an event message handler from being called by ProcessEvents() RemoveEventHandler() will search for previously registered event handlers that have the same function pointer and/or user pointer, and remove them for being called again in the future. More...
 
Mouse + Keyboard State
const int * GetMousePosition () const
 Get the mouse position. More...
 
void GetMousePosition (int *x, int *y) const
 Get the mouse position. More...
 
bool GetMouseButton (uint32_t button) const
 Get the mouse button state. More...
 
bool GetKey (uint32_t key) const
 Get the state of a key (lowercase, without modifiers applied) More...
 
Mouse Cursor
void SetCursor (uint32_t cursor)
 Set the active mouse cursor. More...
 
void SetDefaultCursor (uint32_t cursor, bool activate=true)
 Set the default mouse cursor that gets used by ResetCursor() More...
 
void ResetCursor ()
 Reset the mouse cursor back to it's default. More...
 
void ResetDefaultCursor (bool activate=true)
 Reset the default cursor back to it's original, the arrow. More...
 
Widgets
glWidgetAddWidget (glWidget *widget)
 Add a widget to the window that recieves events and is rendered. More...
 
void RemoveWidget (glWidget *widget, bool deleteWidget=true)
 Remove a widget from the window (and optionally delete it) More...
 
void RemoveWidget (uint32_t index, bool deleteWidget=true)
 Remove a widget from the window (and optionally delete it) More...
 
void RemoveAllWidgets (bool deleteWidgets=true)
 Remove all widgets from the window (and optionally delete them) More...
 
uint32_t GetNumWidgets () const
 Retrieve the number of widgets. More...
 
glWidgetGetWidget (const uint32_t index) const
 Retrieve a widget. More...
 
int GetWidgetIndex (const glWidget *widget) const
 Retrieve the index of a widget (or -1 if not found) More...
 
glWidgetFindWidget (int x, int y)
 Find first widget by coordinate, or NULL if no widget overlaps with that coordinate. More...
 
std::vector< glWidget * > FindWidgets (int x, int y)
 Find all widgets by coordinate, or NULL if no widget overlaps with that coordinate. More...
 
- Public Member Functions inherited from videoOutput
virtual ~videoOutput ()
 Destroy interface and release all resources. More...
 
template<typename T >
bool Render (T *image, uint32_t width, uint32_t height)
 Render and output the next frame to the stream. More...
 
virtual void Close ()
 Stop streaming the device. More...
 
bool IsStreaming () const
 Check if the device is actively streaming or not. More...
 
uint32_t GetWidth () const
 Return the width of the stream, in pixels. More...
 
uint32_t GetHeight () const
 Return the height of the stream, in pixels. More...
 
float GetFrameRate () const
 Return the framerate, in Hz or FPS. More...
 
uint64_t GetFrameCount () const
 Return the number of frames output. More...
 
const URIGetResource () const
 Return the resource URI of the stream. More...
 
const videoOptionsGetOptions () const
 Return the videoOptions of the stream. More...
 
void AddOutput (videoOutput *output)
 Add an output sub-stream. More...
 
uint32_t GetNumOutputs () const
 Return the number of sub-streams. More...
 
videoOutputGetOutput (uint32_t index) const
 Return a sub-stream. More...
 
bool IsType (uint32_t type) const
 Check if this stream is of a particular type. More...
 
template<typename T >
bool IsType () const
 Check if a this stream is of a particular type. More...
 
const char * TypeToStr () const
 Convert this stream's class type to string. More...
 

Static Public Member Functions

static glDisplayCreate (const char *title=NULL, int width=-1, int height=-1, float r=0.05f, float g=0.05f, float b=0.05f, float a=1.0f)
 Create a new OpenGL display window with the specified options. More...
 
static glDisplayCreate (const videoOptions &options)
 Create a new OpenGL display window with the specified options. More...
 
- Static Public Member Functions inherited from videoOutput
static videoOutputCreate (const videoOptions &options)
 Create videoOutput interface from a videoOptions struct that's already been filled out. More...
 
static videoOutputCreate (const char *URI, const videoOptions &options=videoOptions())
 Create videoOutput interface from a resource URI string and optional videoOptions. More...
 
static videoOutputCreate (const char *URI, const commandLine &cmdLine)
 Create videoOutput interface from a resource URI string and parsing command line arguments. More...
 
static videoOutputCreate (const char *URI, const int argc, char **argv)
 Create videoOutput interface from a resource URI string and parsing command line arguments. More...
 
static videoOutputCreate (const int argc, char **argv, int positionArg=-1)
 Create videoOutput interface by parsing command line arguments, including the resource URI. More...
 
static videoOutputCreate (const commandLine &cmdLine, int positionArg=-1)
 Create videoOutput interface by parsing command line arguments, including the resource URI. More...
 
static videoOutputCreateNullOutput ()
 Create videoOutput interface that acts as a NULL output and does nothing with incoming frames. More...
 
static const char * Usage ()
 Usage string for command line arguments to Create() More...
 
static const char * TypeToStr (uint32_t type)
 Convert a class type to a string. More...
 

Static Public Attributes

static const uint32_t Type = (1 << 3)
 Unique type identifier of glDisplay class. More...
 

Protected Member Functions

 glDisplay (const videoOptions &options)
 
bool initWindow ()
 
bool initGL ()
 
glTextureallocTexture (uint32_t width, uint32_t height, imageFormat format)
 
void activateViewport ()
 
void dispatchEvent (uint16_t msg, int a, int b)
 
- Protected Member Functions inherited from videoOutput
 videoOutput (const videoOptions &options)
 

Static Protected Member Functions

static bool onEvent (uint16_t msg, int a, int b, void *user)
 

Protected Attributes

Display * mDisplayX
 
Screen * mScreenX
 
XVisualInfo * mVisualX
 
Window mWindowX
 
GLXContext mContextGL
 
Cursor mCursors [256]
 
int mActiveCursor
 
int mDefaultCursor
 
bool mInitialShow
 
bool mRendering
 
bool mResizedToFeed
 
Atom mWindowClosedMsg
 
DragMode mDragMode
 
uint32_t mID
 
uint32_t mScreenWidth
 
uint32_t mScreenHeight
 
timespec mLastTime
 
float mAvgTime
 
float mBgColor [4]
 
int mViewport [4]
 
int mMousePos [2]
 
int mMouseDrag [2]
 
int mMouseDragOrigin [2]
 
bool mMouseButtons [16]
 
bool mKeyStates [1024]
 
float * mNormalizedCUDA
 
uint32_t mNormalizedWidth
 
uint32_t mNormalizedHeight
 
std::vector< glWidget * > mWidgets
 
std::vector< glTexture * > mTextures
 
std::vector< eventHandlermEventHandlers
 
- Protected Attributes inherited from videoOutput
bool mStreaming
 
videoOptions mOptions
 
std::vector< videoOutput * > mOutputs
 

Static Protected Attributes

static const int screenIdx = 0
 

Status Bar Text

static const char * DEFAULT_TITLE
 Default title bar name. More...
 
virtual void SetStatus (const char *str)
 Set the window title string. More...
 
void SetTitle (const char *str)
 Set the window title string. More...
 

Mouse Dragging

enum  DragMode { DragDefault, DragDisabled, DragSelect, DragCreate }
 Drag behavior enum. More...
 
DragMode GetDragMode () const
 Get the dragging behavior mode. More...
 
void SetDragMode (DragMode mode)
 Set the dragging behavior mode. More...
 
bool IsDragging (DragMode mode=DragDefault) const
 Is the mouse currently dragging in the specified mode? More...
 
bool GetDragRect (int *x, int *y, int *width, int *height)
 Get the current dragging rectangle, or return false if not dragging. More...
 
bool GetDragCoords (int *x1, int *y1, int *x2, int *y2)
 Get the current dragging coordinates, or return false if not dragging. More...
 

Detailed Description

OpenGL display window and image/video renderer with CUDA interoperability.

Note
glDisplay implements the videoOutput interface and is intended to be used through that as opposed to directly. videoOutput implements additional command-line parsing of videoOptions to construct instances.
See also
videoOutput

Member Enumeration Documentation

◆ DragMode

Drag behavior enum.

See also
GetDragMode()
SetDragMode()
Enumerator
DragDefault 

Issue MOUSE_DRAG events, but nothing else.

DragDisabled 

Disable issuing all MOUSE_DRAG events.

DragSelect 

Select widgets from a dragging rectangle, and issue WIDGET_SELECTED events.

DragCreate 

Create a new widget from a dragging rectangle, and issue WIDGET_CREATED events.

Constructor & Destructor Documentation

◆ ~glDisplay()

glDisplay::~glDisplay ( )

Destroy window.

◆ glDisplay()

glDisplay::glDisplay ( const videoOptions options)
protected

Member Function Documentation

◆ activateViewport()

void glDisplay::activateViewport ( )
protected

◆ AddEventHandler()

void glDisplay::AddEventHandler ( glEventHandler  callback,
void *  user = NULL 
)

Register an event message handler that will be called by ProcessEvents()

Parameters
callbackfunction pointer to the event message handler callback
useroptional user-specified pointer that will be passed to all invocations of this event handler (typically an object)

◆ AddWidget()

glWidget* glDisplay::AddWidget ( glWidget widget)

Add a widget to the window that recieves events and is rendered.

◆ allocTexture()

glTexture* glDisplay::allocTexture ( uint32_t  width,
uint32_t  height,
imageFormat  format 
)
protected

◆ BeginRender()

void glDisplay::BeginRender ( bool  processEvents = true)

Clear window and begin rendering a frame.

If processEvents is true, ProcessEvents() will automatically be called.

◆ Create() [1/2]

static glDisplay* glDisplay::Create ( const char *  title = NULL,
int  width = -1,
int  height = -1,
float  r = 0.05f,
float  g = 0.05f,
float  b = 0.05f,
float  a = 1.0f 
)
static

Create a new OpenGL display window with the specified options.

Parameters
titlewindow title bar string, or NULL for a default title
widthdesired width of the window, or -1 to be maximized
heightdesired height of the window, or -1 to be maximized
rdefault background RGBA color, red component (0.0-1.0f)
gdefault background RGBA color, green component (0.0-1.0f)
bdefault background RGBA color, blue component (0.0-1.0f)
adefault background RGBA color, alpha component (0.0-1.0f)

◆ Create() [2/2]

static glDisplay* glDisplay::Create ( const videoOptions options)
static

Create a new OpenGL display window with the specified options.

◆ dispatchEvent()

void glDisplay::dispatchEvent ( uint16_t  msg,
int  a,
int  b 
)
protected

◆ EndRender()

void glDisplay::EndRender ( )

Finish rendering and refresh / flip the backbuffer.

◆ FindWidget()

glWidget* glDisplay::FindWidget ( int  x,
int  y 
)

Find first widget by coordinate, or NULL if no widget overlaps with that coordinate.

◆ FindWidgets()

std::vector<glWidget*> glDisplay::FindWidgets ( int  x,
int  y 
)

Find all widgets by coordinate, or NULL if no widget overlaps with that coordinate.

◆ GetBackgroundColor()

void glDisplay::GetBackgroundColor ( float *  r,
float *  g,
float *  b,
float *  a = NULL 
)

Retrieve the window's background color.

◆ GetDragCoords()

bool glDisplay::GetDragCoords ( int *  x1,
int *  y1,
int *  x2,
int *  y2 
)

Get the current dragging coordinates, or return false if not dragging.

◆ GetDragMode()

DragMode glDisplay::GetDragMode ( ) const
inline

Get the dragging behavior mode.

◆ GetDragRect()

bool glDisplay::GetDragRect ( int *  x,
int *  y,
int *  width,
int *  height 
)

Get the current dragging rectangle, or return false if not dragging.

◆ GetFPS()

float glDisplay::GetFPS ( ) const
inline

Get the average frame time (in milliseconds).

◆ GetID()

uint32_t glDisplay::GetID ( ) const
inline

Get the ID of this display instance into glGetDisplay()

◆ GetKey()

bool glDisplay::GetKey ( uint32_t  key) const
inline

Get the state of a key (lowercase, without modifiers applied)

Similar to glEvent::KEY_STATE, GetKey() queries the raw key state without being translated by modifier keys such as Shift, CapsLock, NumLock, ect. Alphanumeric keys will be left as lowercase, so query lowercase keys - uppercase keys will always return false.

Parameters
keythe XK_ key symbol (see /usr/include/X11/keysymdef.h)
       Uppercase keys like XK_A or XK_plus will always return false.
       Instead, query the lowercase keys such as XK_a, XK_1, ect.

       Other keys like F1-F12, shift, tab, ctrl/alt, arrow keys, 
       backspace, delete, escape, and enter can all be queried.

       GetKey() caches the first 1024 key symbols. Other keys will
       return false, but can be subscribed to through a glEventHander.
Returns
true if the key is pressed, otherwise false

◆ GetMouseButton()

bool glDisplay::GetMouseButton ( uint32_t  button) const
inline

Get the mouse button state.

Parameters
buttonthe button number, starting with 1. In X11, the left mouse button is 1. Here are the mouse button numbers:
  • 1 MOUSE_LEFT (left button)

2 MOUSE_MIDDLE (middle button / scroll wheel button)

  • 3 MOUSE_RIGHT (right button)
  • 4 MOUSE_WHEEL_UP (scroll wheel up)
  • 5 MOUSE_WHEEL_DOWN (scroll wheel down)
Returns
true if the button is pressed, otherwise false

◆ GetMousePosition() [1/2]

const int* glDisplay::GetMousePosition ( ) const
inline

Get the mouse position.

◆ GetMousePosition() [2/2]

void glDisplay::GetMousePosition ( int *  x,
int *  y 
) const
inline

Get the mouse position.

◆ GetNumWidgets()

uint32_t glDisplay::GetNumWidgets ( ) const
inline

Retrieve the number of widgets.

◆ GetType()

virtual uint32_t glDisplay::GetType ( ) const
inlinevirtual

Return the interface type (glDisplay::Type)

Reimplemented from videoOutput.

◆ GetWidget()

glWidget* glDisplay::GetWidget ( const uint32_t  index) const
inline

Retrieve a widget.

◆ GetWidgetIndex()

int glDisplay::GetWidgetIndex ( const glWidget widget) const

Retrieve the index of a widget (or -1 if not found)

◆ initGL()

bool glDisplay::initGL ( )
protected

◆ initWindow()

bool glDisplay::initWindow ( )
protected

◆ IsClosed()

bool glDisplay::IsClosed ( ) const
inline

Returns true if the window has been closed.

◆ IsDragging()

bool glDisplay::IsDragging ( DragMode  mode = DragDefault) const
inline

Is the mouse currently dragging in the specified mode?

◆ IsFullscreen()

bool glDisplay::IsFullscreen ( )

Determine if the window is fullscreen or not.

◆ IsMaximized()

bool glDisplay::IsMaximized ( )

Determine if the window is maximized or not.

◆ IsOpen()

bool glDisplay::IsOpen ( ) const
inline

Returns true if the window is open.

◆ IsRendering()

bool glDisplay::IsRendering ( ) const
inline

Returns true if between BeginRender() and EndRender()

◆ onEvent()

static bool glDisplay::onEvent ( uint16_t  msg,
int  a,
int  b,
void *  user 
)
staticprotected

◆ Open()

virtual bool glDisplay::Open ( )
virtual

Open the window.

See also
videoOutput::Open()

Reimplemented from videoOutput.

◆ ProcessEvents()

void glDisplay::ProcessEvents ( )

Process UI event messages.

Any queued events will be dispatched to the event message handlers that were registered with RegisterEventHandler()

ProcessEvents() usually gets called automatically by BeginFrame(), so it is not typically necessary to explicitly call it unless you passed false to BeginFrame() and wish to process events at another time of your choosing.

See also
glEventType
glEventHandler

◆ RemoveAllWidgets()

void glDisplay::RemoveAllWidgets ( bool  deleteWidgets = true)

Remove all widgets from the window (and optionally delete them)

◆ RemoveEventHandler()

void glDisplay::RemoveEventHandler ( glEventHandler  callback,
void *  user = NULL 
)

Remove an event message handler from being called by ProcessEvents() RemoveEventHandler() will search for previously registered event handlers that have the same function pointer and/or user pointer, and remove them for being called again in the future.

◆ RemoveWidget() [1/2]

void glDisplay::RemoveWidget ( glWidget widget,
bool  deleteWidget = true 
)

Remove a widget from the window (and optionally delete it)

◆ RemoveWidget() [2/2]

void glDisplay::RemoveWidget ( uint32_t  index,
bool  deleteWidget = true 
)

Remove a widget from the window (and optionally delete it)

◆ Render() [1/4]

void glDisplay::Render ( float *  image,
uint32_t  width,
uint32_t  height,
float  x = 0.0f,
float  y = 30.0f,
bool  normalize = true 
)

Render a CUDA float4 image using OpenGL interop If normalize is true, the image's pixel values will be rescaled from the range of [0-255] to [0-1] If normalize is false, the image's pixel values are assumed to already be in the range of [0-1] Note that if normalization is selected to be performed, it will be done in-place on the image.

◆ Render() [2/4]

void glDisplay::Render ( glTexture texture,
float  x = 5.0f,
float  y = 30.0f 
)

Render an OpenGL texture.

Note
for more texture rendering methods,
See also
glTexture

◆ Render() [3/4]

template<typename T >
bool glDisplay::Render ( T *  image,
uint32_t  width,
uint32_t  height 
)
inline

Render a CUDA image (uchar3, uchar4, float3, float4) using OpenGL interop.

This is similar to RenderOnce(), in that it will begin/end the frame also.

See also
videoOutput::Render

◆ Render() [4/4]

virtual bool glDisplay::Render ( void *  image,
uint32_t  width,
uint32_t  height,
imageFormat  format 
)
virtual

Render a CUDA image (uchar3, uchar4, float3, float4) using OpenGL interop.

This is similar to RenderOnce(), in that it will begin/end the frame also.

See also
videoOutput::Render

Reimplemented from videoOutput.

◆ RenderImage()

void glDisplay::RenderImage ( void *  image,
uint32_t  width,
uint32_t  height,
imageFormat  format,
float  x = 0.0f,
float  y = 30.0f,
bool  normalize = true 
)

Render a CUDA image (uchar3, uchar4, float3, float4) using OpenGL interop.

If normalize is true, the image's pixel values will be rescaled from the range of [0-255] to [0-1] If normalize is false, the image's pixel values are assumed to already be in the range of [0-1] Note that if normalization is selected to be performed, it will be done in-place on the image

◆ RenderLine()

void glDisplay::RenderLine ( float  x1,
float  y1,
float  x2,
float  y2,
float  r,
float  g,
float  b,
float  a = 1.0f,
float  thickness = 2.0f 
)

Render a line in screen coordinates with the specified color.

Note
the RGBA color values are expected to be in the range of [0-1]

◆ RenderOnce() [1/2]

void glDisplay::RenderOnce ( float *  image,
uint32_t  width,
uint32_t  height,
float  x = 5.0f,
float  y = 30.0f,
bool  normalize = true 
)

Begin the frame, render one CUDA float4 image using OpenGL interop, and end the frame.

Note that this function is only useful if you are rendering a single texture per frame. If normalize is true, the image's pixel values will be rescaled from the range of [0-255] to [0-1] If normalize is false, the image's pixel values are assumed to already be in the range of [0-1] Note that if normalization is selected to be performed, it will be done in-place on the image

◆ RenderOnce() [2/2]

void glDisplay::RenderOnce ( void *  image,
uint32_t  width,
uint32_t  height,
imageFormat  format,
float  x = 5.0f,
float  y = 30.0f,
bool  normalize = true 
)

Begin the frame, render one CUDA image using OpenGL interop, and end the frame.

Note that this function is only useful if you are rendering a single texture per frame. If normalize is true, the image's pixel values will be rescaled from the range of [0-255] to [0-1] If normalize is false, the image's pixel values are assumed to already be in the range of [0-1] Note that if normalization is selected to be performed, it will be done in-place on the image

◆ RenderOutline()

void glDisplay::RenderOutline ( float  x,
float  y,
float  width,
float  height,
float  r,
float  g,
float  b,
float  a = 1.0f,
float  thickness = 2.0f 
)

Render the outline of a rect in screen coordinates with the specified color.

Note
the RGBA color values are expected to be in the range of [0-1]

◆ RenderRect() [1/2]

void glDisplay::RenderRect ( float  r,
float  g,
float  b,
float  a = 1.0f 
)

Render a filled rect covering the current viewport with the specified color.

Note
the RGBA color values are expected to be in the range of [0-1]

◆ RenderRect() [2/2]

void glDisplay::RenderRect ( float  x,
float  y,
float  width,
float  height,
float  r,
float  g,
float  b,
float  a = 1.0f 
)

Render a filled rect in screen coordinates with the specified color.

Note
the RGBA color values are expected to be in the range of [0-1]

◆ ResetCursor()

void glDisplay::ResetCursor ( )

Reset the mouse cursor back to it's default.

The default mouse cursor is defined by SetDefaultCursor().

See also
SetDefaultCursor()
SetCursor()

◆ ResetDefaultCursor()

void glDisplay::ResetDefaultCursor ( bool  activate = true)

Reset the default cursor back to it's original, the arrow.

Parameters
activateif true (default), the active cursor will be changed to this new default cursor immediately. If false, the active cursor will stay the same until ResetCursor() gets called in the future.
See also
SetDefaultCursor()
SetCursor()
ResetCursor()

◆ ResetViewport()

void glDisplay::ResetViewport ( )

Reset to the full viewport (and change back GL_PROJECTION)

◆ SetBackgroundColor()

void glDisplay::SetBackgroundColor ( float  r,
float  g,
float  b,
float  a = 1.0f 
)

Set the window's background color.

Parameters
rbackground RGBA color, red component (0.0-1.0f)
gbackground RGBA color, green component (0.0-1.0f)
bbackground RGBA color, blue component (0.0-1.0f)
abackground RGBA color, alpha component (0.0-1.0f)

◆ SetCursor()

void glDisplay::SetCursor ( uint32_t  cursor)

Set the active mouse cursor.

Parameters
cursorone of the cursor ID's from X11/cursorfont.h
See also
ResetCursor() to restore the cursor back to default
SetDefaultCursor() to change the default cursor

◆ SetDefaultCursor()

void glDisplay::SetDefaultCursor ( uint32_t  cursor,
bool  activate = true 
)

Set the default mouse cursor that gets used by ResetCursor()

Parameters
cursorone of the cursor ID's from X11/cursorfont.h. This will be the default cursor that gets set when ResetCursor() is called.
activateif true (default), the active cursor will be changed to this new default cursor immediately. If false, the active cursor will stay the same until ResetCursor() gets called in the future.
See also
ResetCursor()
ResetDefaultCursor()
SetCursor()

◆ SetDragMode()

void glDisplay::SetDragMode ( DragMode  mode)
inline

Set the dragging behavior mode.

◆ SetFullscreen()

void glDisplay::SetFullscreen ( bool  fullscreen)

Set the window to fullscreen mode or not.

◆ SetMaximized()

void glDisplay::SetMaximized ( bool  maximized)

Maximize or un-maximize the window.

◆ SetSize()

void glDisplay::SetSize ( uint32_t  width,
uint32_t  height 
)

Set the window's size.

Parameters
widththe desired width of the window, in pixels.
heightthe desired height of the window, in pixels.
Note
modifying the window's size will reset the viewport to cover the full area of the new size of the window.

◆ SetStatus()

virtual void glDisplay::SetStatus ( const char *  str)
virtual

Set the window title string.

Reimplemented from videoOutput.

◆ SetTitle()

void glDisplay::SetTitle ( const char *  str)

Set the window title string.

Deprecated:
SetTitle() has been superceded by SetStatus() from videoOutput API. SetTitle() is functionally the same as SetStatus().

◆ SetViewport()

void glDisplay::SetViewport ( int  left,
int  top,
int  right,
int  bottom 
)

Set the active viewport being rendered to.

SetViewport() will update the GL_PROJECTION matrix with a new ortho matrix to reflect these changes.

After done rendering to this viewport, you should reset it back to it's original with ResetViewport()

Member Data Documentation

◆ DEFAULT_TITLE

const char* glDisplay::DEFAULT_TITLE
static

Default title bar name.

◆ mActiveCursor

int glDisplay::mActiveCursor
protected

◆ mAvgTime

float glDisplay::mAvgTime
protected

◆ mBgColor

float glDisplay::mBgColor[4]
protected

◆ mContextGL

GLXContext glDisplay::mContextGL
protected

◆ mCursors

Cursor glDisplay::mCursors[256]
protected

◆ mDefaultCursor

int glDisplay::mDefaultCursor
protected

◆ mDisplayX

Display* glDisplay::mDisplayX
protected

◆ mDragMode

DragMode glDisplay::mDragMode
protected

◆ mEventHandlers

std::vector<eventHandler> glDisplay::mEventHandlers
protected

◆ mID

uint32_t glDisplay::mID
protected

◆ mInitialShow

bool glDisplay::mInitialShow
protected

◆ mKeyStates

bool glDisplay::mKeyStates[1024]
protected

◆ mLastTime

timespec glDisplay::mLastTime
protected

◆ mMouseButtons

bool glDisplay::mMouseButtons[16]
protected

◆ mMouseDrag

int glDisplay::mMouseDrag[2]
protected

◆ mMouseDragOrigin

int glDisplay::mMouseDragOrigin[2]
protected

◆ mMousePos

int glDisplay::mMousePos[2]
protected

◆ mNormalizedCUDA

float* glDisplay::mNormalizedCUDA
protected

◆ mNormalizedHeight

uint32_t glDisplay::mNormalizedHeight
protected

◆ mNormalizedWidth

uint32_t glDisplay::mNormalizedWidth
protected

◆ mRendering

bool glDisplay::mRendering
protected

◆ mResizedToFeed

bool glDisplay::mResizedToFeed
protected

◆ mScreenHeight

uint32_t glDisplay::mScreenHeight
protected

◆ mScreenWidth

uint32_t glDisplay::mScreenWidth
protected

◆ mScreenX

Screen* glDisplay::mScreenX
protected

◆ mTextures

std::vector<glTexture*> glDisplay::mTextures
protected

◆ mViewport

int glDisplay::mViewport[4]
protected

◆ mVisualX

XVisualInfo* glDisplay::mVisualX
protected

◆ mWidgets

std::vector<glWidget*> glDisplay::mWidgets
protected

◆ mWindowClosedMsg

Atom glDisplay::mWindowClosedMsg
protected

◆ mWindowX

Window glDisplay::mWindowX
protected

◆ screenIdx

const int glDisplay::screenIdx = 0
staticprotected

◆ Type

const uint32_t glDisplay::Type = (1 << 3)
static

Unique type identifier of glDisplay class.


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