- /* Why drawing here and not in Render()? Because this way, the
- OpenGL providers can call pf_display to force redraw. Currently,
- the OS X provider uses it to get a smooth window resizing */
-
- glClear( GL_COLOR_BUFFER_BIT );
-
- if( p_sys->i_effect == OPENGL_EFFECT_NONE )
- {
- glEnable( VLCGL_TARGET );
- glBegin( GL_POLYGON );
- glTexCoord2f( f_x, f_y ); glVertex2f( -1.0, 1.0 );
- glTexCoord2f( f_width, f_y ); glVertex2f( 1.0, 1.0 );
- glTexCoord2f( f_width, f_height ); glVertex2f( 1.0, -1.0 );
- glTexCoord2f( f_x, f_height ); glVertex2f( -1.0, -1.0 );
- glEnd();
- }
- else
- {
- glRotatef( 0.5 * p_sys->f_speed , 0.3, 0.5, 0.7 );
-
- glEnable( VLCGL_TARGET );
- glBegin( GL_QUADS );
-
- /* Front */
- glTexCoord2f( f_x, f_y ); glVertex3f( - 1.0, 1.0, 1.0 );
- glTexCoord2f( f_x, f_height ); glVertex3f( - 1.0, - 1.0, 1.0 );
- glTexCoord2f( f_width, f_height ); glVertex3f( 1.0, - 1.0, 1.0 );
- glTexCoord2f( f_width, f_y ); glVertex3f( 1.0, 1.0, 1.0 );
-
- /* Left */
- glTexCoord2f( f_x, f_y ); glVertex3f( - 1.0, 1.0, - 1.0 );
- glTexCoord2f( f_x, f_height ); glVertex3f( - 1.0, - 1.0, - 1.0 );
- glTexCoord2f( f_width, f_height ); glVertex3f( - 1.0, - 1.0, 1.0 );
- glTexCoord2f( f_width, f_y ); glVertex3f( - 1.0, 1.0, 1.0 );
-
- /* Back */
- glTexCoord2f( f_x, f_y ); glVertex3f( 1.0, 1.0, - 1.0 );
- glTexCoord2f( f_x, f_height ); glVertex3f( 1.0, - 1.0, - 1.0 );
- glTexCoord2f( f_width, f_height ); glVertex3f( - 1.0, - 1.0, - 1.0 );
- glTexCoord2f( f_width, f_y ); glVertex3f( - 1.0, 1.0, - 1.0 );
-
- /* Right */
- glTexCoord2f( f_x, f_y ); glVertex3f( 1.0, 1.0, 1.0 );
- glTexCoord2f( f_x, f_height ); glVertex3f( 1.0, - 1.0, 1.0 );
- glTexCoord2f( f_width, f_height ); glVertex3f( 1.0, - 1.0, - 1.0 );
- glTexCoord2f( f_width, f_y ); glVertex3f( 1.0, 1.0, - 1.0 );
-
- /* Top */
- glTexCoord2f( f_x, f_y ); glVertex3f( - 1.0, 1.0, - 1.0 );
- glTexCoord2f( f_x, f_height ); glVertex3f( - 1.0, 1.0, 1.0 );
- glTexCoord2f( f_width, f_height ); glVertex3f( 1.0, 1.0, 1.0 );
- glTexCoord2f( f_width, f_y ); glVertex3f( 1.0, 1.0, - 1.0 );
-
- /* Bottom */
- glTexCoord2f( f_x, f_y ); glVertex3f( - 1.0, - 1.0, 1.0 );
- glTexCoord2f( f_x, f_height ); glVertex3f( - 1.0, - 1.0, - 1.0 );
- glTexCoord2f( f_width, f_height ); glVertex3f( 1.0, - 1.0, - 1.0 );
- glTexCoord2f( f_width, f_y ); glVertex3f( 1.0, - 1.0, 1.0 );
- glEnd();
- }
-
- glDisable( VLCGL_TARGET );
-
- p_sys->p_vout->pf_swap( p_sys->p_vout );
-
- if( p_sys->p_vout->pf_unlock )
- {
- p_sys->p_vout->pf_unlock( p_sys->p_vout );
- }
-}
-
-int GetAlignedSize( int i_size )
-{
- /* Return the nearest power of 2 */
- int i_result = 1;
- while( i_result < i_size )
- {
- i_result *= 2;
- }
- return i_result;
-}
-
-/*****************************************************************************
- * Control: control facility for the vout
- *****************************************************************************/
-static int Control( vout_thread_t *p_vout, int i_query, va_list args )
-{
- vout_sys_t *p_sys = p_vout->p_sys;
-
- switch( i_query )
- {
- case VOUT_SNAPSHOT:
- return vout_vaControlDefault( p_vout, i_query, args );
-
- default:
- if( p_sys->p_vout->pf_control )
- return p_sys->p_vout->pf_control( p_sys->p_vout, i_query, args );
- else
- return vout_vaControlDefault( p_vout, i_query, args );
- }
-}
-
-static int InitTextures( vout_thread_t *p_vout )
-{
- vout_sys_t *p_sys = p_vout->p_sys;
- int i_index;
-
- glDeleteTextures( 2, p_sys->p_textures );
- glGenTextures( 2, p_sys->p_textures );
-
- for( i_index = 0; i_index < 2; i_index++ )
- {
- glBindTexture( VLCGL_TARGET, p_sys->p_textures[i_index] );
-
- /* Set the texture parameters */
- glTexParameterf( VLCGL_TARGET, GL_TEXTURE_PRIORITY, 1.0 );
-
- glTexParameteri( VLCGL_TARGET, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
- glTexParameteri( VLCGL_TARGET, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
-
- glTexParameteri( VLCGL_TARGET, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
- glTexParameteri( VLCGL_TARGET, GL_TEXTURE_MIN_FILTER, GL_LINEAR );