![]() |
Jetson Inference
DNN Vision Library
|
OpenGL textures and display window (X11/GLX). More...
Classes | |
class | glBuffer |
OpenGL buffer with CUDA interoperability. More... | |
class | glCamera |
OpenGL perspective camera supporting Look-At, Yaw/Pitch/Roll, and Ortho modes. More... | |
class | glDisplay |
OpenGL display window and image/video renderer with CUDA interoperability. More... | |
class | glTexture |
OpenGL texture with CUDA interoperability. More... | |
class | glWidget |
OpenGL graphics widget for rendering moveable/resizable shapes. More... | |
Macros | |
#define | GL_VERTEX_BUFFER GL_ARRAY_BUFFER |
Alias for vertex buffers. More... | |
#define | GL_INDEX_BUFFER GL_ELEMENT_ARRAY_BUFFER |
Alias for index buffers. More... | |
#define | GL_MAP_CPU 0x1 |
Map the buffer to CPU address space. More... | |
#define | GL_MAP_CUDA 0x2 |
Map the buffer to CUDA address space. More... | |
#define | GL_FROM_CPU 0x3 |
Copy the buffer from CPU to OpenGL. More... | |
#define | GL_FROM_CUDA 0x4 |
Copy the buffer from CUDA to OpenGL. More... | |
#define | GL_TO_CPU 0x5 |
Copy the buffer to CPU from OpenGL. More... | |
#define | GL_TO_CUDA 0x6 |
Copy the buffer to CUDA from OpenGL. More... | |
#define | GL_WRITE_DISCARD (GL_READ_WRITE + 0xff) |
Map the buffer as write-only and discard previous contents. More... | |
#define | GL_WRITE_ONLY GL_WRITE_ONLY_ARB |
Map the buffer with write-only access. More... | |
#define | GL_READ_ONLY GL_READ_ONLY_ARB |
Map the buffer with read-only access. More... | |
#define | GL_READ_WRITE GL_READ_WRITE_ARB |
Map the buffer with read/write access. More... | |
#define | KEY_PRESSED 1 |
Define for KEY_STATE and KEY_RAW events when key is pressed. More... | |
#define | KEY_RELEASED 0 |
Define for KEY_STATE and KEY_RAW events when key is released. More... | |
#define | MOUSE_PRESSED 1 |
Define for MOUSE_BUTTON event when button is pressed. More... | |
#define | MOUSE_RELEASED 0 |
Define for MOUSE_BUTTON event when button is released. More... | |
#define | MOUSE_LEFT 1 |
Define for the left mouse button number. More... | |
#define | MOUSE_MIDDLE 2 |
Define for the middle mouse button (or scroll wheel button) More... | |
#define | MOUSE_RIGHT 3 |
Define for the right mouse button number. More... | |
#define | MOUSE_WHEEL_UP 4 |
Define for the mouse wheel scroll up button number. More... | |
#define | MOUSE_WHEEL_DOWN 5 |
Define for the mouse wheel scroll down button number. More... | |
#define | GL_RGB32F GL_RGB32F_ARB |
Alias for GL_RGB32F. More... | |
#define | GL_RGBA32F GL_RGBA32F_ARB |
Alias for GL_RGBA32F. More... | |
#define | LOG_GL "[OpenGL] " |
OpenGL logging prefix. More... | |
#define | GL(x) { x; glCheckError( #x, __FILE__, __LINE__ ); } |
OpenGL error-checking macro. More... | |
#define | GL_VERIFY(x) { x; if(glCheckError( #x, __FILE__, __LINE__ )) return false; } |
Return false on OpenGL error. More... | |
#define | GL_VERIFYN(x) { x; if(glCheckError( #x, __FILE__, __LINE__ )) return NULL; } |
OpenGL NULL on OpenGL error. More... | |
#define | GL_CHECK(msg) { glCheckError(msg, __FILE__, __LINE__); } |
Print a message on OpenGL error. More... | |
Typedefs | |
typedef bool(* | glEventHandler) (uint16_t event, int a, int b, void *user) |
Event message handler callback for recieving UI messages from a window. More... | |
Enumerations | |
enum | glEventType { MOUSE_MOVE = 0, MOUSE_ABSOLUTE, MOUSE_BUTTON, MOUSE_DRAG, MOUSE_WHEEL, KEY_STATE, KEY_MODIFIED, KEY_CHAR, WIDGET_CREATED, WIDGET_SELECTED, WIDGET_MOVED, WIDGET_RESIZED, WINDOW_RESIZED, WINDOW_CLOSED } |
User interface event message types. More... | |
Functions | |
glDisplay * | glGetDisplay (uint32_t display=0) |
Retrieve a display window object. More... | |
uint32_t | glGetNumDisplays () |
Return the number of created glDisplay windows. More... | |
bool | glCheckError (const char *msg, const char *file, int line) |
OpenGL error-checking messsage function. More... | |
bool | glCheckError (const char *msg) |
OpenGL error check + logging. More... | |
void | glPrintFreeMem () |
Print the amount of free GPU memory. More... | |
void | glDrawLine (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 | glDrawOutline (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 | glDrawRect (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... | |
OpenGL textures and display window (X11/GLX).
#define GL | ( | x | ) | { x; glCheckError( #x, __FILE__, __LINE__ ); } |
OpenGL error-checking macro.
#define GL_CHECK | ( | msg | ) | { glCheckError(msg, __FILE__, __LINE__); } |
Print a message on OpenGL error.
#define GL_FROM_CPU 0x3 |
Copy the buffer from CPU to OpenGL.
#define GL_FROM_CUDA 0x4 |
Copy the buffer from CUDA to OpenGL.
#define GL_INDEX_BUFFER GL_ELEMENT_ARRAY_BUFFER |
Alias for index buffers.
#define GL_MAP_CPU 0x1 |
Map the buffer to CPU address space.
#define GL_MAP_CUDA 0x2 |
Map the buffer to CUDA address space.
#define GL_READ_ONLY GL_READ_ONLY_ARB |
Map the buffer with read-only access.
#define GL_READ_WRITE GL_READ_WRITE_ARB |
Map the buffer with read/write access.
#define GL_RGB32F GL_RGB32F_ARB |
Alias for GL_RGB32F.
#define GL_RGBA32F GL_RGBA32F_ARB |
Alias for GL_RGBA32F.
#define GL_TO_CPU 0x5 |
Copy the buffer to CPU from OpenGL.
#define GL_TO_CUDA 0x6 |
Copy the buffer to CUDA from OpenGL.
#define GL_VERIFY | ( | x | ) | { x; if(glCheckError( #x, __FILE__, __LINE__ )) return false; } |
Return false on OpenGL error.
#define GL_VERIFYN | ( | x | ) | { x; if(glCheckError( #x, __FILE__, __LINE__ )) return NULL; } |
OpenGL NULL on OpenGL error.
#define GL_VERTEX_BUFFER GL_ARRAY_BUFFER |
Alias for vertex buffers.
#define GL_WRITE_DISCARD (GL_READ_WRITE + 0xff) |
Map the buffer as write-only and discard previous contents.
#define GL_WRITE_ONLY GL_WRITE_ONLY_ARB |
Map the buffer with write-only access.
#define KEY_PRESSED 1 |
Define for KEY_STATE and KEY_RAW events when key is pressed.
#define KEY_RELEASED 0 |
Define for KEY_STATE and KEY_RAW events when key is released.
#define LOG_GL "[OpenGL] " |
OpenGL logging prefix.
#define MOUSE_LEFT 1 |
Define for the left mouse button number.
#define MOUSE_MIDDLE 2 |
Define for the middle mouse button (or scroll wheel button)
#define MOUSE_PRESSED 1 |
Define for MOUSE_BUTTON event when button is pressed.
#define MOUSE_RELEASED 0 |
Define for MOUSE_BUTTON event when button is released.
#define MOUSE_RIGHT 3 |
Define for the right mouse button number.
#define MOUSE_WHEEL_DOWN 5 |
Define for the mouse wheel scroll down button number.
#define MOUSE_WHEEL_UP 4 |
Define for the mouse wheel scroll up button number.
typedef bool(* glEventHandler) (uint16_t event, int a, int b, void *user) |
Event message handler callback for recieving UI messages from a window.
Recieves 4 parameters - the event type, a & b message values (see above), and a user-specified pointer from registration.
Event message handlers should return true
if the message was handled, or false
if the message was skipped or not handled.
enum glEventType |
User interface event message types.
Each event message consists of the event type, a & b message values, and a user-specified pointer. The event types and message values are desribed below for each type of message.
These event messages are dispatched at runtime to glEventHandler callbacks that have been registered via glRegisterEvents()
Enumerator | |
---|---|
MOUSE_MOVE | Message when the mouse has moved (relative coordinates) a = x position, relative to window top-left b = y position, relative to window top-left
|
MOUSE_ABSOLUTE | Message when the mouse has moved (absolute coordinates) a = x position, in absolute screen coordinates b = y position, in absolute screen coordinates
|
MOUSE_BUTTON | Message when a mouse button has been pressed/released. a = button ID b = MOUSE_PRESSED or MOUSE_RELEASED Here is the mapping of the mouse buttons to their ID: - 1 MOUSE_LEFT (left button)
|
MOUSE_DRAG | Message when the left mouse button has been dragged. a = x delta (change in position) b = y delta (change in position)
|
MOUSE_WHEEL | Message when the mouse wheel has been scrolled a = -1 for scrolled up, or +1 for scrolled down. |
KEY_STATE | Message when a key state has changed (raw, without modifiers applied) a = raw key symbol (without modifier translation) b = KEY_PRESSED or KEY_RELEASED These raw symbols are left unmodified, so they won't be changed by keys like Shift, CapsLock, NumLock, ect. Letters will always be reported as lowercase. For example if you press Shift + a, it will still be reported as XK_a (a)
|
KEY_MODIFIED | Message when a key has been pressed or released (with modifiers applied) a = key symbol (with modifier translations) b = KEY_PRESSED or KEY_RELEASED These symbols have modifiers applied (Shift, CapsLock, NumLock, ect), so for example if you press Shift + a, it will be reported as XK_A (A)
|
KEY_CHAR | Message when a keyboard ASCII character (0-255) was entered. a = ASCII character (0-9, a-Z, !-?, ect.) These will have modifiers applied (Shift, CapsLock, NumLock, ect), so for example if you press Shift + a, it will be reported as 'A'. |
WIDGET_CREATED | Message indicating that a widget has been created (e.g. from dragging) a = widget index into glDisplay::GetWidget() or glWidget::GetIndex()
|
WIDGET_SELECTED | Message indicating that a widget has been selected (e.g. from dragging) a = widget index into glDisplay::GetWidget() or glWidget::GetIndex()
|
WIDGET_MOVED | Message from a widget indicating that it's been moved by the user. This event is only sent if the user moved the widget in the GUI (i.e. if glWidget::IsMoveable() was set), and not if the widget was moved programatically via glWidget::Move(), glWidget::SetPosition(), glWidget::SetX(), glWidget::SetY(), ect. a = new X coordinate b = new Y coordinate
|
WIDGET_RESIZED | Message from a widget indicating that it's been resized. This event is only sent if the user resized the widget in the GUI (i.e. if glWidget::IsResizable() was set), and not if the widget was resized programatically via glWidget::SetSize(), glWidget::SetWidth(), or glWidget::SetHeight(). a = new width b = new height
|
WINDOW_RESIZED | Message indicating that the window has been resized. a = new width (in pixels) b = new height (in pixels) |
WINDOW_CLOSED | Message indicating that the window is closing. (no parameters) |
|
inline |
OpenGL error-checking messsage function.
|
inline |
OpenGL error check + logging.
|
inline |
Render a line in screen coordinates with the specified color.
|
inline |
Render the outline of a rect in screen coordinates with the specified color.
|
inline |
Render a filled rect in screen coordinates with the specified color.
glDisplay* glGetDisplay | ( | uint32_t | display = 0 | ) |
Retrieve a display window object.
uint32_t glGetNumDisplays | ( | ) |
Return the number of created glDisplay windows.
|
inline |
Print the amount of free GPU memory.