* macosx.m: MacOS X module for vlc
*****************************************************************************
* Copyright (C) 2001-2003 VideoLAN
- * $Id: macosx.m,v 1.19 2004/01/26 18:30:37 titer Exp $
+ * $Id: macosx.m,v 1.20 2004/02/09 13:28:31 titer Exp $
*
* Authors: Colin Delacroix <colin@zoy.org>
* Eugenio Jarosiewicz <ej0@cise.ufl.edu>
"0 is fully transparent.")
#define OPENGL_TEXT N_("Use OpenGL")
-#define OPENGL_LONGTEXT N_( \
- "Use OpenGL instead of QuickTime to render the video on the screen." )
+#define OPENGL_LONGTEXT N_("Use OpenGL instead of QuickTime to " \
+ "render the video on the screen.")
+
+#define OPENGL_EFFECT_TEXT N_("OpenGL effect")
+#define OPENGL_EFFECT_LONGTEXT N_("Use 'None' to display the video " \
+ "without any fantasy, 'Cube' to let the video play on " \
+ "transparent faces of a rotating cube")
+
+static char * effect_list[] = { "none", "cube" };
+static char * effect_list_text[] = { N_("None"), N_("Cube") };
vlc_module_begin();
set_description( _("MacOS X interface, sound and video") );
OPAQUENESS_TEXT, OPAQUENESS_LONGTEXT, VLC_TRUE );
add_bool( "macosx-opengl", 0, NULL, OPENGL_TEXT,
OPENGL_LONGTEXT, VLC_TRUE );
+ add_string( "macosx-opengl-effect", "none", NULL,
+ OPENGL_EFFECT_TEXT, OPENGL_EFFECT_LONGTEXT,
+ VLC_TRUE );
+ change_string_list( effect_list, effect_list_text, 0 );
vlc_module_end();
* vout.m: MacOS X video output module
*****************************************************************************
* Copyright (C) 2001-2003 VideoLAN
- * $Id: vout.m,v 1.77 2004/02/03 13:00:27 titer Exp $
+ * $Id: vout.m,v 1.78 2004/02/09 13:28:32 titer Exp $
*
* Authors: Colin Delacroix <colin@zoy.org>
* Florian G. Pflug <fgp@phlo.org>
#define QT_MAX_DIRECTBUFFERS 10
#define VL_MAX_DISPLAYS 16
+#define OPENGL_EFFECT_NONE 1
+#define OPENGL_EFFECT_CUBE 2
+
struct picture_sys_t
{
void *p_info;
- (id) initWithFrame: (NSRect) frame vout: (vout_thread_t*) _p_vout
{
+ char * psz_effect;
p_vout = _p_vout;
NSOpenGLPixelFormatAttribute attribs[] =
[[self openGLContext] makeCurrentContext];
[[self openGLContext] update];
+
+ /* Black bacjground */
glClearColor( 0.0, 0.0, 0.0, 0.0 );
+ /* Check if the user asked for useless visual effects */
+ psz_effect = config_GetPsz( p_vout, "macosx-opengl-effect" );
+ if( !strcmp( psz_effect, "none" ) )
+ {
+ i_effect = OPENGL_EFFECT_NONE;
+ }
+ else if( !strcmp( psz_effect, "cube" ) )
+ {
+ i_effect = OPENGL_EFFECT_CUBE;
+ glMatrixMode( GL_PROJECTION );
+ glLoadIdentity();
+ glFrustum( -1.0, 1.0, -1.0, 1.0, 3.0, 20.0 );
+ glMatrixMode( GL_MODELVIEW );
+ glLoadIdentity();
+ glTranslatef( 0.0, 0.0, - 5.0 );
+ glBlendFunc( GL_SRC_ALPHA, GL_ONE );
+ glEnable( GL_BLEND );
+ glEnable( GL_POLYGON_SMOOTH );
+ glDisable( GL_DEPTH_TEST );
+ }
+ else
+ {
+ msg_Warn( p_vout, "no valid opengl effect provided, using "
+ "\"none\"" );
+ i_effect = OPENGL_EFFECT_NONE;
+ }
+
b_init_done = 0;
return self;
PP_OUTPUTPICTURE[0]->p_data );
}
+- (void) drawQuad
+{
+ glBegin( GL_QUADS );
+ /* Top left */
+ glTexCoord2f( 0.0, 0.0 );
+ glVertex3f( - 1.0, 1.0, 1.0 );
+ /* Bottom left */
+ glTexCoord2f( 0.0, (float) p_vout->output.i_height );
+ glVertex3f( - 1.0, - 1.0, 1.0 );
+ /* Bottom right */
+ glTexCoord2f( (float) p_vout->output.i_width,
+ (float) p_vout->output.i_height );
+ glVertex3f( 1.0, - 1.0, 1.0 );
+ /* Top right */
+ glTexCoord2f( (float) p_vout->output.i_width, 0.0 );
+ glVertex3f( 1.0, 1.0, 1.0 );
+ glEnd();
+}
+
+- (void) drawCube
+{
+ glBegin( GL_QUADS );
+ glTexCoord2f( 0.0, 0.0 );
+ glVertex3f( - 1.0, 1.0, 1.0 );
+ glTexCoord2f( 0.0, (float) p_vout->output.i_height );
+ glVertex3f( - 1.0, - 1.0, 1.0 );
+ glTexCoord2f( (float) p_vout->output.i_width,
+ (float) p_vout->output.i_height );
+ glVertex3f( 1.0, - 1.0, 1.0 );
+ glTexCoord2f( (float) p_vout->output.i_width, 0.0 );
+ glVertex3f( 1.0, 1.0, 1.0 );
+ glEnd();
+ glBegin( GL_QUADS );
+ glTexCoord2f( 0.0, 0.0 );
+ glVertex3f( - 1.0, 1.0, - 1.0 );
+ glTexCoord2f( 0.0, (float) p_vout->output.i_height );
+ glVertex3f( - 1.0, - 1.0, - 1.0 );
+ glTexCoord2f( (float) p_vout->output.i_width,
+ (float) p_vout->output.i_height );
+ glVertex3f( - 1.0, - 1.0, 1.0 );
+ glTexCoord2f( (float) p_vout->output.i_width, 0.0 );
+ glVertex3f( - 1.0, 1.0, 1.0 );
+ glEnd();
+ glBegin( GL_QUADS );
+ glTexCoord2f( 0.0, 0.0 );
+ glVertex3f( 1.0, 1.0, - 1.0 );
+ glTexCoord2f( 0.0, (float) p_vout->output.i_height );
+ glVertex3f( 1.0, - 1.0, - 1.0 );
+ glTexCoord2f( (float) p_vout->output.i_width,
+ (float) p_vout->output.i_height );
+ glVertex3f( - 1.0, - 1.0, - 1.0 );
+ glTexCoord2f( (float) p_vout->output.i_width, 0.0 );
+ glVertex3f( - 1.0, 1.0, - 1.0 );
+ glEnd();
+ glBegin( GL_QUADS );
+ glTexCoord2f( 0.0, 0.0 );
+ glVertex3f( 1.0, 1.0, 1.0 );
+ glTexCoord2f( 0.0, (float) p_vout->output.i_height );
+ glVertex3f( 1.0, - 1.0, 1.0 );
+ glTexCoord2f( (float) p_vout->output.i_width,
+ (float) p_vout->output.i_height );
+ glVertex3f( 1.0, - 1.0, - 1.0 );
+ glTexCoord2f( (float) p_vout->output.i_width, 0.0 );
+ glVertex3f( 1.0, 1.0, - 1.0 );
+ glEnd();
+ glBegin( GL_QUADS );
+ glTexCoord2f( 0.0, 0.0 );
+ glVertex3f( - 1.0, 1.0, - 1.0 );
+ glTexCoord2f( 0.0, (float) p_vout->output.i_height );
+ glVertex3f( - 1.0, 1.0, 1.0 );
+ glTexCoord2f( (float) p_vout->output.i_width,
+ (float) p_vout->output.i_height );
+ glVertex3f( 1.0, 1.0, 1.0 );
+ glTexCoord2f( (float) p_vout->output.i_width, 0.0 );
+ glVertex3f( 1.0, 1.0, - 1.0 );
+ glEnd();
+ glBegin( GL_QUADS );
+ glTexCoord2f( 0.0, 0.0 );
+ glVertex3f( - 1.0, - 1.0, 1.0 );
+ glTexCoord2f( 0.0, (float) p_vout->output.i_height );
+ glVertex3f( - 1.0, - 1.0, - 1.0 );
+ glTexCoord2f( (float) p_vout->output.i_width,
+ (float) p_vout->output.i_height );
+ glVertex3f( 1.0, - 1.0, - 1.0 );
+ glTexCoord2f( (float) p_vout->output.i_width, 0.0 );
+ glVertex3f( 1.0, - 1.0, 1.0 );
+ glEnd();
+}
+
- (void) drawRect: (NSRect) rect
{
[[self openGLContext] makeCurrentContext];
return;
}
- /* Draw a quad with our texture on it */
+ /* Draw */
glBindTexture( GL_TEXTURE_RECTANGLE_EXT, i_texture );
- glBegin( GL_QUADS );
- /* Top left */
- glTexCoord2f( 0.0, 0.0 );
- glVertex2f( - f_x, f_y );
- /* Bottom left */
- glTexCoord2f( 0.0, (float) p_vout->output.i_height );
- glVertex2f( - f_x, - f_y );
- /* Bottom right */
- glTexCoord2f( (float) p_vout->output.i_width,
- (float) p_vout->output.i_height );
- glVertex2f( f_x, - f_y );
- /* Top right */
- glTexCoord2f( (float) p_vout->output.i_width, 0.0 );
- glVertex2f( f_x, f_y );
- glEnd();
+ if( i_effect == OPENGL_EFFECT_CUBE )
+ {
+ glRotatef( 1.0, 0.5, 0.5, 1.0 );
+ [self drawCube];
+ }
+ else
+ {
+ [self drawQuad];
+ }
/* Wait for the job to be done */
[[self openGLContext] flushBuffer];