+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_MAG_FILTER, GL_LINEAR );
+ glTexParameteri( VLCGL_TARGET, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
+
+ glTexParameteri( VLCGL_TARGET, GL_TEXTURE_WRAP_S, GL_CLAMP );
+ glTexParameteri( VLCGL_TARGET, GL_TEXTURE_WRAP_T, GL_CLAMP );
+
+ glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
+
+#ifdef SYS_DARWIN
+ /* 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 );
+#else
+ /* Use AGP texturing */
+ glTexParameteri( VLCGL_TARGET, GL_TEXTURE_STORAGE_HINT_APPLE,
+ GL_STORAGE_SHARED_APPLE );
+#endif
+#endif
+
+ /* Call glTexImage2D only once, and use glTexSubImage2D later */
+ glTexImage2D( VLCGL_TARGET, 0, 3, p_sys->i_tex_width,
+ p_sys->i_tex_height, 0, VLCGL_FORMAT, VLCGL_TYPE,
+ p_sys->pp_buffer[i_index] );
+ }
+
+ return 0;
+}
+