- 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();
-
- 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;
-
- if( p_sys->p_vout->pf_control )
- return p_sys->p_vout->pf_control( p_sys->p_vout, i_query, args );
- return VLC_EGENERIC;
-}
-
-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 );
-
- glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
-
-#ifdef __APPLE__
- /* Tell the driver not to make a copy of the texture but to use
- our buffer */
- glEnable( GL_UNPACK_CLIENT_STORAGE_APPLE );
- glPixelStorei( GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE );
-
-#if 0
- /* Use VRAM texturing */
- glTexParameteri( VLCGL_TARGET, GL_TEXTURE_STORAGE_HINT_APPLE,
- GL_STORAGE_CACHED_APPLE );
+ /* Why drawing here and not in Render()? Because this way, the
+ OpenGL providers can call vout_display_opengl_Display to force redraw.i
+ Currently, the OS X provider uses it to get a smooth window resizing */
+
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ glEnable(VLCGL_TARGET);
+
+#if USE_OPENGL_ES
+ static const GLfloat vertexCoord[] = {
+ -1.0f, -1.0f,
+ 1.0f, -1.0f,
+ -1.0f, 1.0f,
+ 1.0f, 1.0f,
+ };
+
+ const GLfloat textureCoord[8] = {
+ f_x, f_height,
+ f_width, f_height,
+ f_x, f_y,
+ f_width, f_y
+ };
+
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+ glVertexPointer(2, GL_FLOAT, 0, vertexCoord);
+ glTexCoordPointer(2, GL_FLOAT, 0, textureCoord);
+
+ glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);