mvRenderToOpenGL(3dm) mvRenderToOpenGL(3dm)
mvRenderMovieToOpenGL, mvRenderMovieToImageBuffer, mvRenderTrackToOpenGL
- display of visual data from movies and tracks
#include <dmedia/moviefile.h>
DMstatus mvRenderMovieToOpenGL( MVid movie,
MVtime time, MVtimescale timeScale );
DMstatus mvRenderMovieToImageBuffer( MVid movie,
MVtime time, MVtimescale timeScale,
void *buffer, DMparams *formatParams );
DMstatus mvRenderTrackToOpenGL( MVid track,
MVtime time, MVtimescale timeScale );
The movie and track rendering routines provide a way for applications to
access or display the data stored in movies. These routines are intended
to replace mvReadFrames(), which is still provided for backwards
compatibility.
mvRenderMovieToOpenGL
This function renders a movie at an instance in time to the current
OpenGL/X context.
Only enabled tracks are rendered (see also mvSetTrackEnable(3dm)). The
position at which the movie is to be drawn is determined by the movie
rectangle (which can be set by mvSetMovieRect(3dm)) which, by default, is
the bounding rectangle of all the tracks with its bottom right corner
coinciding that of the window. The tracks are laid out according to the
matrices assigned to each track (see also mvSetMovieMatrix(3dm) and
mvSetTrackMatrix(3dm)). If there is no current GLXContext (or
GLXDrawable) mvRenderMovieToOpenGL returns DM_FAILURE and the current
error is set to MV_ERROR_MAKE_CURRENT.
movie is the id of the movie to be rendered.
time is the time at which the movie is to be rendered. If the time is
not a valid movie time, an error is set, nothing is drawn to the GL
context and DM_FAILURE is returned. If no track had valid data to be
drawn at this time, but the time is a valid movie time, DM_FAILURE is
returned and the error MV_NOTHING_RENDERED is set. Users can make use of
this property to fill in the ``movie background''.
timeScale is the timescale for time.
Page 1
mvRenderToOpenGL(3dm) mvRenderToOpenGL(3dm)
mvRenderMovieToImageBuffer
This function renders a movie at an instance in time to an arbitrary
buffer.
movie is the id of the movie to be rendered.
time is the time at which the movie is to be rendered. If the time is
not a valid movie time, an error is set, nothing is drawn to the GL
context and DM_FAILURE is returned. If no track had valid data to be
drawn at this time, but the time is a valid movie time, the buffer will
be zeroed out and DM_SUCCESS is returned.
timeScale is the timescale for time.
buffer is the pointer to the buffer that the movie library will write to.
The user is responsible for allocating and deallocating this buffer and
for making sure that it is big enough for the movie library to write to.
formatParams is the set of parameters that describes the format of the
image the user expects to appear in the buffer pointed to by buffer. The
following parameters must be included:
DM_IMAGE_WIDTH: indicates the width of the image. The movie library does
the necessary resizing to fit the image into this width.
DM_IMAGE_HEIGHT: indicates the width of the height. The movie library
does the necessary resizing to fit the image into this height.
DM_IMAGE_PACKING: indicates the packing of the image. Currently, only
DM_IMAGE_PACKING_RGBX and DM_IMAGE_PACKING_XBGR are supported.
DM_IMAGE_ORIENTATION: indicates the orientation of the image. This can
either be DM_IMAGE_TOP_TO_BOTTOM or DM_IMAGE_BOTTOM_TO_TOP.
MV_IMAGE_STRIDE: indicates the number of pixels to skip after every row
of pixels drawn into buffer.
The following parameters are optional:
MV_BLEND_SRC: Specifies how the red, green, blue, and alpha source
blending factors are computed. Directly relates to the the GLenum sfactor
parameter specified in the OpenGL call glBlendFunc. Refer to the
glBlendFunc(3G) man page for specifc usage information.
MV_BLEND_DST: Specifies how the red, green, blue, and alpha destination
blending factors are computed. Directly relates to the the GLenum dfactor
parameter specified in the OpenGL call glBlendFunc. Refer to the
glBlendFunc(3G) man page for specific usage information.
mvRenderTrackToOpenGL
Page 2
mvRenderToOpenGL(3dm) mvRenderToOpenGL(3dm)
This function renders an instance of a track to the current GLX context.
The function performs the matrix operation on top of the existing context
and then draws the image.
track is the id of the track to be rendered.
time is the time at which the movie is to be rendered. If this time is
beyond the duration of the track, or is part of an empty segment, the
error MV_NOTHING_RENDERED will be set and DM_FAILURE will be returned.
Otherwise, DM_SUCCESS will be returned.
timescale is the timescale for time.
#include <dmedia/moviefile.h>
/*
* render to middle of a GLX widget
*/
void RenderToScreen( MVid movie, MVtime time, MVtimescale timescale,
Display *dpy, Widget widget,
GLXContext glx_context )
{
Dimension width, height;
MVrect movie_rect;
/* get the widget's dimension */
XtVaGetValues( widget, XmNwidth, &width, XmNheight, &height );
/* set up movie rectangle */
movie_rect.bottom = height / 4;
movie_rect.left = width / 4;
movie_rect.top = 3 * height / 4;
movie_rect.right = 3 * width / 4;
mvSetMovieRect( movie, movie_rect );
/* make context current */
glXMakeCurrent( dpy, widget, glx_context );
/* render */
mvRenderMovieToGL( movie, time, timescale );
}
The X VisualInfo structure used to create the GLXContext that is made
current before a call to mvRenderMovieToOpenGL(3dm) or
mvRenderTrackToOpenGL(3dm) must support RGBA visuals. You should also
insure that the GLXDrawable (e.g., window) and the GLXContext support the
Page 3
mvRenderToOpenGL(3dm) mvRenderToOpenGL(3dm)
same number of bits of red, green, blue, alpha, and Z depth.
glXChooseVisual(3G), glXCreateContext(3G), glXMakeCurrent(3G),
glBlendFunc(3G), mvIntro(3dm), mvMovieRect(3dm), mvMatrix(3dm),
mvReadFrames(3dm), mvGetErrno(3dm), mvInsertFramesAtTime(3dm),
mvRenderMovieToAudioBuffer(3dm).
PPPPaaaaggggeeee 4444 [ Back ]
|