openvideo::GLUTSink Class Reference
[Node Classes]
GLUTSink implements an OpenVideo node to display a certain video stream.
More...
#include <GLUTSink.h>
Inherits openvideo::Node.
Public Member Functions | |
| GLUTSink () | |
| ~GLUTSink () | |
| virtual void | start () |
| virtual void | init () |
| virtual void | process () |
| virtual void | initPixelFormats () |
| HGLRC | getGLContext () |
| HDC | getDeviceHandle () |
| Display * | getDisplay () |
| GLXContext | getGLContext () |
| GLXDrawable | getDeviceHandle () |
Static Public Attributes | |
| static std::vector< openvideo::GLUTSink * > | glutSinks |
Protected Types | |
| enum | { TEXTURE_WIDTH = 1024, TEXTURE_HEIGHT = 1024 } |
Protected Member Functions | |
| void | updateTexture () |
| void | redraw () |
Static Protected Member Functions | |
| static void * | mainLoop (void *) |
| static void | mainDisplayFunc () |
| static void | idleFunc () |
Protected Attributes | |
| int | winHandle |
| bool | updateVideo |
| int | width |
| int | height |
| int | originX |
| int | originY |
| int | format |
| int | internalFormat |
| unsigned int | video_texture_id |
| bool | flip_h |
| bool | flip_v |
| float | t_u0 |
| float | t_u1 |
| float | t_v0 |
| float | t_v1 |
| BufferSynchronizer | bufferSychronizer |
| unsigned int | updateCtr |
| GLXDrawable | dc |
| Display * | dsp |
| GLXContext | glContext |
| HGLRC | glContext |
| HDC | dc |
Static Protected Attributes | |
| static bool | glutRedraw = false |
| static bool | isGlutThread = false |
Detailed Description
GLUTSink implements an OpenVideo node to display a certain video stream.It displays the frame buffer of the context element of it's first input node as a 2dtexture which gets updated every time a traversal takes place. The glut environment runs in it's own thread. it permanently checks in it's idle function if something has changed which forces a redraw of one of the glut windows.
Supported Pixel Formats:
- : R8G8B8
Definition at line 65 of file GLUTSink.h.
Member Enumeration Documentation
|
|
maximal texture size
Definition at line 197 of file GLUTSink.h. |
Constructor & Destructor Documentation
|
|
constructor
Definition at line 72 of file GLUTSink.cxx. References dsp, glContext, height, internalFormat, openvideo::Node::name, originX, originY, openvideo::Node::state, openvideo::Node::typeName, updateCtr, updateVideo, and width. |
|
|
destructor
Definition at line 136 of file GLUTSink.cxx. |
Member Function Documentation
|
|
|
|
|
Definition at line 96 of file GLUTSink.cxx. References dc. Referenced by mainDisplayFunc(). |
|
|
Definition at line 116 of file GLUTSink.cxx. References dsp. Referenced by mainDisplayFunc(). |
|
|
|
|
|
Definition at line 90 of file GLUTSink.cxx. References glContext. Referenced by mainDisplayFunc(). |
|
|
glut's idle function
Definition at line 411 of file GLUTSink.cxx. Referenced by mainLoop(). |
|
|
Is called once before the (process)traversal starts. Init should be used to implement any initializations a specific node needs. Reimplemented from openvideo::Node. Definition at line 205 of file GLUTSink.cxx. References openvideo::Node::curPixelFormat, flip_h, flip_v, format, openvideo::FORMAT_B8G8R8, openvideo::FORMAT_B8G8R8X8, openvideo::FORMAT_L8, openvideo::FORMAT_R8G8B8, openvideo::FORMAT_R8G8B8X8, openvideo::PixelFormat::FormatToString(), openvideo::Manager::getInstance(), glutSinks, openvideo::State::height, height, openvideo::Node::inputs, internalFormat, openvideo::Node::name, openvideo::Node::state, t_u0, t_u1, t_v0, t_v1, TEXTURE_HEIGHT, TEXTURE_WIDTH, openvideo::State::width, and width. |
|
|
return value = the number of supported input formats. the formats are stored in 'pixelFormats'. Implements openvideo::Node. Definition at line 122 of file GLUTSink.cxx. References openvideo::FORMAT_B8G8R8, openvideo::FORMAT_B8G8R8X8, openvideo::FORMAT_L8, openvideo::FORMAT_R8G8B8, openvideo::FORMAT_R8G8B8X8, and openvideo::Node::pixelFormats. |
|
|
glut's main display function
Definition at line 417 of file GLUTSink.cxx. References getDeviceHandle(), getDisplay(), getGLContext(), openvideo::Manager::getInstance(), glutSinks, and winHandle. Referenced by mainLoop(). |
|
|
glut's main loop
Definition at line 142 of file GLUTSink.cxx. References dc, dsp, format, openvideo::Node::getName(), glContext, glutSinks, height, idleFunc(), internalFormat, mainDisplayFunc(), originX, originY, TEXTURE_HEIGHT, TEXTURE_WIDTH, video_texture_id, width, and winHandle. Referenced by start(). |
|
|
Sets a flag which is read by glut's idle function, which afterwards calls a 'glutPostRedisplay()'. We do it this way because glut's idle function runs in the same thread than gluts main display function. 'process()' then waits untill the main display function updates the texture with the new video data. Reimplemented from openvideo::Node. Definition at line 328 of file GLUTSink.cxx. References openvideo::BufferSynchronizer::assign(), bufferSychronizer, openvideo::State::getCurrentBuffer(), and openvideo::Node::state. |
|
|
applies the texture. postGLCalls() Definition at line 370 of file GLUTSink.cxx. References t_u0, t_u1, t_v0, t_v1, and video_texture_id. |
|
|
sets its context to use the context of its first parent and initializes the texture paramaters. start() also adds itself to the static list of "glutSinks", which is later used by the glut thread to access all the glutsink nodes. if the glut environment isn't up and running yet, start() will create a new thread where the main glut loop runs in. Reimplemented from openvideo::Node. Definition at line 304 of file GLUTSink.cxx. References openvideo::Manager::getInstance(), isGlutThread, and mainLoop(). |
|
|
function which updated the texture with the new video frame.
Definition at line 339 of file GLUTSink.cxx. References bufferSychronizer, openvideo::BufferSynchronizer::getLocked(), openvideo::Buffer::getPixels(), openvideo::Buffer::getUpdateCounter(), height, openvideo::Buffer::unlock(), updateCtr, video_texture_id, and width. |
Member Data Documentation
|
|
Definition at line 199 of file GLUTSink.h. Referenced by process(), and updateTexture(). |
|
|
Definition at line 211 of file GLUTSink.h. |
|
|
Definition at line 204 of file GLUTSink.h. Referenced by getDeviceHandle(), and mainLoop(). |
|
|
Definition at line 205 of file GLUTSink.h. Referenced by getDisplay(), GLUTSink(), and mainLoop(). |
|
|
Defines a video flip.
Definition at line 186 of file GLUTSink.h. Referenced by init(). |
|
|
Defines a video flip.
Definition at line 186 of file GLUTSink.h. Referenced by init(). |
|
|
texture format.
Definition at line 171 of file GLUTSink.h. Referenced by init(), and mainLoop(). |
|
|
Definition at line 210 of file GLUTSink.h. |
|
|
Definition at line 206 of file GLUTSink.h. Referenced by getGLContext(), GLUTSink(), and mainLoop(). |
|
|
A flag to indicate glut's idle function we need a redraw.
Definition at line 69 of file GLUTSink.cxx. |
|
|
static list off all glut sinks currently running.
Definition at line 68 of file GLUTSink.cxx. Referenced by init(), mainDisplayFunc(), and mainLoop(). |
|
|
self explaining
Definition at line 166 of file GLUTSink.h. Referenced by GLUTSink(), init(), mainLoop(), and updateTexture(). |
|
|
Internal texture format. defines the number of color components in the texture. valid values = 1,2,3, or 4. Definition at line 176 of file GLUTSink.h. Referenced by GLUTSink(), init(), and mainLoop(). |
|
|
A flag to prevent multiple calls to start the glut environment.
Definition at line 67 of file GLUTSink.cxx. Referenced by start(). |
|
|
self explaining
Definition at line 166 of file GLUTSink.h. Referenced by GLUTSink(), and mainLoop(). |
|
|
self explaining
Definition at line 166 of file GLUTSink.h. Referenced by GLUTSink(), and mainLoop(). |
|
|
Define the current ratio of the max. texture size and the current video size. Definition at line 191 of file GLUTSink.h. |
|
|
Define the current ratio of the max. texture size and the current video size. Definition at line 191 of file GLUTSink.h. |
|
|
Definition at line 192 of file GLUTSink.h. |
|
|
Definition at line 192 of file GLUTSink.h. |
|
|
Definition at line 200 of file GLUTSink.h. Referenced by GLUTSink(), and updateTexture(). |
|
|
A flag to indicate this sink needs an update of it's video texture. it is set in the 'process()' function and used by the main window function to find the sink which invokes the redraw. Definition at line 151 of file GLUTSink.h. Referenced by GLUTSink(). |
|
|
open gl's texture id
Definition at line 181 of file GLUTSink.h. Referenced by mainLoop(), redraw(), and updateTexture(). |
|
|
self explaining
Definition at line 166 of file GLUTSink.h. Referenced by GLUTSink(), init(), mainLoop(), and updateTexture(). |
|
|
The sinks window handle.
Definition at line 145 of file GLUTSink.h. Referenced by mainDisplayFunc(), and mainLoop(). |
The documentation for this class was generated from the following files:
