1 /*****************************************************************************
2 * opengl.c: OpenGL video output
3 *****************************************************************************
4 * Copyright (C) 2004 the VideoLAN team
7 * Authors: Cyril Deguet <asmax@videolan.org>
8 * Gildas Bazin <gbazin@videolan.org>
9 * Eric Petit <titer@m0k.org>
10 * Cedric Cocquebert <cedric.cocquebert@supelec.fr>
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
25 *****************************************************************************/
27 /*****************************************************************************
29 *****************************************************************************/
35 #include <errno.h> /* ENOMEM */
37 #include <vlc_common.h>
38 #include <vlc_plugin.h>
42 # include <OpenGL/gl.h>
43 # include <OpenGL/glext.h>
49 # define YCBCR_MESA 0x8757
51 #ifndef UNSIGNED_SHORT_8_8_MESA
52 # define UNSIGNED_SHORT_8_8_MESA 0x85BA
55 #ifndef GL_UNSIGNED_SHORT_5_6_5
56 # define GL_UNSIGNED_SHORT_5_6_5 0x8363
58 #ifndef GL_CLAMP_TO_EDGE
59 # define GL_CLAMP_TO_EDGE 0x812F
63 /* On OS X, use GL_TEXTURE_RECTANGLE_EXT instead of GL_TEXTURE_2D.
64 This allows sizes which are not powers of 2 */
65 # define VLCGL_TARGET GL_TEXTURE_RECTANGLE_EXT
67 /* OS X OpenGL supports YUV. Hehe. */
68 # define VLCGL_FORMAT GL_YCBCR_422_APPLE
69 # define VLCGL_TYPE GL_UNSIGNED_SHORT_8_8_APPLE
72 # define VLCGL_TARGET GL_TEXTURE_2D
75 # define VLCGL_RGB_FORMAT GL_RGBA
76 # define VLCGL_RGB_TYPE GL_UNSIGNED_BYTE
79 # define VLCGL_YUV_FORMAT YCBCR_MESA
80 # define VLCGL_YUV_TYPE UNSIGNED_SHORT_8_8_MESA
82 /* Use RGB on Win32/GLX */
83 # define VLCGL_FORMAT VLCGL_RGB_FORMAT
84 # define VLCGL_TYPE VLCGL_RGB_TYPE
88 /*****************************************************************************
90 *****************************************************************************/
91 static int CreateVout ( vlc_object_t * );
92 static void DestroyVout ( vlc_object_t * );
93 static int Init ( vout_thread_t * );
94 static void End ( vout_thread_t * );
95 static int Manage ( vout_thread_t * );
96 static void Render ( vout_thread_t *, picture_t * );
97 static void DisplayVideo ( vout_thread_t *, picture_t * );
98 static int Control ( vout_thread_t *, int, va_list );
100 static inline int GetAlignedSize( int );
102 static int InitTextures ( vout_thread_t * );
103 static int SendEvents ( vlc_object_t *, char const *,
104 vlc_value_t, vlc_value_t, void * );
106 #define PROVIDER_TEXT N_("OpenGL Provider")
107 #define PROVIDER_LONGTEXT N_("Allows you to modify what OpenGL provider should be used")
110 set_shortname( "OpenGL" )
111 set_category( CAT_VIDEO )
112 set_subcategory( SUBCAT_VIDEO_VOUT )
113 set_description( N_("OpenGL video output") )
115 set_capability( "video output", 200 )
117 set_capability( "video output", 20 )
119 add_shortcut( "opengl" )
120 /* Allow opengl provider plugin selection */
121 add_module( "opengl-provider", "opengl provider", NULL, NULL,
122 PROVIDER_TEXT, PROVIDER_LONGTEXT, true )
123 set_callbacks( CreateVout, DestroyVout )
126 /*****************************************************************************
127 * vout_sys_t: video output method descriptor
128 *****************************************************************************
129 * This structure is part of the video output thread descriptor.
130 * It describes the OpenGL specific properties of the output thread.
131 *****************************************************************************/
134 vout_thread_t *p_vout;
136 uint8_t *pp_buffer[2];
140 GLuint p_textures[2];
143 /*****************************************************************************
144 * CreateVout: This function allocates and initializes the OpenGL vout method.
145 *****************************************************************************/
146 static int CreateVout( vlc_object_t *p_this )
148 vout_thread_t *p_vout = (vout_thread_t *)p_this;
152 /* Allocate structure */
153 p_vout->p_sys = p_sys = malloc( sizeof( vout_sys_t ) );
159 p_sys->i_tex_width = p_vout->fmt_in.i_width;
160 p_sys->i_tex_height = p_vout->fmt_in.i_height;
162 /* A texture must have a size aligned on a power of 2 */
163 p_sys->i_tex_width = GetAlignedSize( p_vout->fmt_in.i_width );
164 p_sys->i_tex_height = GetAlignedSize( p_vout->fmt_in.i_height );
167 msg_Dbg( p_vout, "Texture size: %dx%d", p_sys->i_tex_width,
168 p_sys->i_tex_height );
172 (vout_thread_t *)vlc_object_create( p_this, sizeof( vout_thread_t ) );
173 if( p_sys->p_vout == NULL )
178 vlc_object_attach( p_sys->p_vout, p_this );
180 p_sys->p_vout->i_window_width = p_vout->i_window_width;
181 p_sys->p_vout->i_window_height = p_vout->i_window_height;
182 p_sys->p_vout->b_fullscreen = p_vout->b_fullscreen;
183 p_sys->p_vout->render.i_width = p_vout->render.i_width;
184 p_sys->p_vout->render.i_height = p_vout->render.i_height;
185 p_sys->p_vout->render.i_aspect = p_vout->render.i_aspect;
186 p_sys->p_vout->fmt_render = p_vout->fmt_render;
187 p_sys->p_vout->fmt_in = p_vout->fmt_in;
188 p_sys->p_vout->b_autoscale = p_vout->b_autoscale;
189 p_sys->p_vout->i_zoom = p_vout->i_zoom;
190 p_sys->p_vout->i_alignment = p_vout->i_alignment;
191 var_Create( p_sys->p_vout, "video-deco",
192 VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
194 /* Forward events from the opengl provider */
195 var_Create( p_sys->p_vout, "mouse-x", VLC_VAR_INTEGER );
196 var_Create( p_sys->p_vout, "mouse-y", VLC_VAR_INTEGER );
197 var_Create( p_sys->p_vout, "mouse-moved", VLC_VAR_BOOL );
198 var_Create( p_sys->p_vout, "mouse-clicked", VLC_VAR_BOOL );
199 var_Create( p_sys->p_vout, "mouse-button-down", VLC_VAR_INTEGER );
200 var_Create( p_sys->p_vout, "video-on-top",
201 VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
202 var_Create( p_sys->p_vout, "autoscale",
203 VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
204 var_Create( p_sys->p_vout, "scale",
205 VLC_VAR_FLOAT | VLC_VAR_DOINHERIT );
207 var_AddCallback( p_sys->p_vout, "mouse-x", SendEvents, p_vout );
208 var_AddCallback( p_sys->p_vout, "mouse-y", SendEvents, p_vout );
209 var_AddCallback( p_sys->p_vout, "mouse-moved", SendEvents, p_vout );
210 var_AddCallback( p_sys->p_vout, "mouse-clicked", SendEvents, p_vout );
211 var_AddCallback( p_sys->p_vout, "mouse-button-down", SendEvents, p_vout );
212 var_AddCallback( p_sys->p_vout, "video-on-top", SendEvents, p_vout );
213 var_AddCallback( p_vout, "autoscale", SendEvents, p_sys->p_vout );
214 var_AddCallback( p_vout, "scale", SendEvents, p_sys->p_vout );
216 psz = var_CreateGetString( p_vout, "opengl-provider" );
217 p_sys->p_vout->p_module =
218 module_need( p_sys->p_vout, "opengl provider", psz, false );
220 if( p_sys->p_vout->p_module == NULL )
222 msg_Warn( p_vout, "No OpenGL provider found" );
223 vlc_object_detach( p_sys->p_vout );
224 /* no need for var_DelCallback here :-) */
225 vlc_object_release( p_sys->p_vout );
230 p_vout->pf_init = Init;
231 p_vout->pf_end = End;
232 p_vout->pf_manage = Manage;
233 p_vout->pf_render = Render;
234 p_vout->pf_display = DisplayVideo;
235 p_vout->pf_control = Control;
240 /*****************************************************************************
241 * Init: initialize the OpenGL video thread output method
242 *****************************************************************************/
243 static int Init( vout_thread_t *p_vout )
245 vout_sys_t *p_sys = p_vout->p_sys;
248 p_sys->p_vout->pf_init( p_sys->p_vout );
250 /* TODO: We use YCbCr on Mac which is Y422, but on OSX it seems to == YUY2. Verify */
251 #if ( defined( WORDS_BIGENDIAN ) && VLCGL_FORMAT == GL_YCBCR_422_APPLE ) || (VLCGL_FORMAT == YCBCR_MESA)
252 p_vout->output.i_chroma = VLC_CODEC_YUYV;
255 #elif (VLCGL_FORMAT == GL_YCBCR_422_APPLE)
256 p_vout->output.i_chroma = VLC_CODEC_UYVY;
259 #elif VLCGL_FORMAT == GL_RGB
260 # if VLCGL_TYPE == GL_UNSIGNED_BYTE
261 p_vout->output.i_chroma = VLC_CODEC_RGB24;
262 # if defined( WORDS_BIGENDIAN )
263 p_vout->output.i_rmask = 0x00ff0000;
264 p_vout->output.i_gmask = 0x0000ff00;
265 p_vout->output.i_bmask = 0x000000ff;
267 p_vout->output.i_rmask = 0x000000ff;
268 p_vout->output.i_gmask = 0x0000ff00;
269 p_vout->output.i_bmask = 0x00ff0000;
273 p_vout->output.i_chroma = VLC_CODEC_RGB16;
274 # if defined( WORDS_BIGENDIAN )
275 p_vout->output.i_rmask = 0x001f;
276 p_vout->output.i_gmask = 0x07e0;
277 p_vout->output.i_bmask = 0xf800;
279 p_vout->output.i_rmask = 0xf800;
280 p_vout->output.i_gmask = 0x07e0;
281 p_vout->output.i_bmask = 0x001f;
286 p_vout->output.i_chroma = VLC_CODEC_RGB32;
287 # if defined( WORDS_BIGENDIAN )
288 p_vout->output.i_rmask = 0xff000000;
289 p_vout->output.i_gmask = 0x00ff0000;
290 p_vout->output.i_bmask = 0x0000ff00;
292 p_vout->output.i_rmask = 0x000000ff;
293 p_vout->output.i_gmask = 0x0000ff00;
294 p_vout->output.i_bmask = 0x00ff0000;
299 /* Since OpenGL can do rescaling for us, stick to the default
300 * coordinates and aspect. */
301 p_vout->output.i_width = p_vout->render.i_width;
302 p_vout->output.i_height = p_vout->render.i_height;
303 p_vout->output.i_aspect = p_vout->render.i_aspect;
305 p_vout->fmt_out = p_vout->fmt_in;
306 p_vout->fmt_out.i_chroma = p_vout->output.i_chroma;
308 /* We know the chroma, allocate one buffer which will be used
309 * directly by the decoder */
310 p_sys->pp_buffer[0] =
311 malloc( p_sys->i_tex_width * p_sys->i_tex_height * i_pixel_pitch );
312 if( !p_sys->pp_buffer[0] )
314 p_sys->pp_buffer[1] =
315 malloc( p_sys->i_tex_width * p_sys->i_tex_height * i_pixel_pitch );
316 if( !p_sys->pp_buffer[1] )
319 p_vout->p_picture[0].i_planes = 1;
320 p_vout->p_picture[0].p->p_pixels = p_sys->pp_buffer[0];
321 p_vout->p_picture[0].p->i_lines = p_vout->output.i_height;
322 p_vout->p_picture[0].p->i_visible_lines = p_vout->output.i_height;
323 p_vout->p_picture[0].p->i_pixel_pitch = i_pixel_pitch;
324 p_vout->p_picture[0].p->i_pitch = p_vout->output.i_width *
325 p_vout->p_picture[0].p->i_pixel_pitch;
326 p_vout->p_picture[0].p->i_visible_pitch = p_vout->output.i_width *
327 p_vout->p_picture[0].p->i_pixel_pitch;
329 p_vout->p_picture[0].i_status = DESTROYED_PICTURE;
330 p_vout->p_picture[0].i_type = DIRECT_PICTURE;
332 PP_OUTPUTPICTURE[ 0 ] = &p_vout->p_picture[0];
334 I_OUTPUTPICTURES = 1;
336 if( p_sys->p_vout->pf_lock &&
337 p_sys->p_vout->pf_lock( p_sys->p_vout ) )
339 msg_Warn( p_vout, "could not lock OpenGL provider" );
343 InitTextures( p_vout );
346 glDisable(GL_DEPTH_TEST);
347 glDepthMask(GL_FALSE);
348 glDisable(GL_CULL_FACE);
349 glClearColor( 0.0f, 0.0f, 0.0f, 1.0f );
350 glClear( GL_COLOR_BUFFER_BIT );
352 if( p_sys->p_vout->pf_unlock )
354 p_sys->p_vout->pf_unlock( p_sys->p_vout );
360 /*****************************************************************************
361 * End: terminate GLX video thread output method
362 *****************************************************************************/
363 static void End( vout_thread_t *p_vout )
365 vout_sys_t *p_sys = p_vout->p_sys;
367 if( p_sys->p_vout->pf_lock &&
368 p_sys->p_vout->pf_lock( p_sys->p_vout ) )
370 msg_Warn( p_vout, "could not lock OpenGL provider" );
377 /* Free the texture buffer*/
378 glDeleteTextures( 2, p_sys->p_textures );
379 free( p_sys->pp_buffer[0] );
380 free( p_sys->pp_buffer[1] );
382 if( p_sys->p_vout->pf_unlock )
384 p_sys->p_vout->pf_unlock( p_sys->p_vout );
387 /* We must release the opengl provider here: opengl requiere init and end
388 to be done in the same thread */
389 module_unneed( p_sys->p_vout, p_sys->p_vout->p_module );
390 vlc_object_release( p_sys->p_vout );
393 /*****************************************************************************
394 * Destroy: destroy GLX video thread output method
395 *****************************************************************************
396 * Terminate an output method created by CreateVout
397 *****************************************************************************/
398 static void DestroyVout( vlc_object_t *p_this )
400 vout_thread_t *p_vout = (vout_thread_t *)p_this;
401 vout_sys_t *p_sys = p_vout->p_sys;
406 /*****************************************************************************
407 * Manage: handle Sys events
408 *****************************************************************************
409 * This function should be called regularly by video output thread. It returns
410 * a non null value if an error occurred.
411 *****************************************************************************/
412 static int Manage( vout_thread_t *p_vout )
414 vout_sys_t *p_sys = p_vout->p_sys;
415 int i_ret, i_fullscreen_change;
417 i_fullscreen_change = ( p_vout->i_changes & VOUT_FULLSCREEN_CHANGE );
419 p_vout->fmt_out.i_x_offset = p_sys->p_vout->fmt_in.i_x_offset =
420 p_vout->fmt_in.i_x_offset;
421 p_vout->fmt_out.i_y_offset = p_sys->p_vout->fmt_in.i_y_offset =
422 p_vout->fmt_in.i_y_offset;
423 p_vout->fmt_out.i_visible_width = p_sys->p_vout->fmt_in.i_visible_width =
424 p_vout->fmt_in.i_visible_width;
425 p_vout->fmt_out.i_visible_height = p_sys->p_vout->fmt_in.i_visible_height =
426 p_vout->fmt_in.i_visible_height;
427 p_vout->fmt_out.i_aspect = p_sys->p_vout->fmt_in.i_aspect =
428 p_vout->fmt_in.i_aspect;
429 p_vout->fmt_out.i_sar_num = p_sys->p_vout->fmt_in.i_sar_num =
430 p_vout->fmt_in.i_sar_num;
431 p_vout->fmt_out.i_sar_den = p_sys->p_vout->fmt_in.i_sar_den =
432 p_vout->fmt_in.i_sar_den;
433 p_vout->output.i_aspect = p_vout->fmt_in.i_aspect;
435 p_sys->p_vout->i_changes = p_vout->i_changes;
436 i_ret = p_sys->p_vout->pf_manage( p_sys->p_vout );
437 p_vout->i_changes = p_sys->p_vout->i_changes;
440 if( p_sys->p_vout->pf_lock &&
441 p_sys->p_vout->pf_lock( p_sys->p_vout ) )
443 msg_Warn( p_vout, "could not lock OpenGL provider" );
447 /* On OS X, we create the window and the GL view when entering
448 fullscreen - the textures have to be inited again */
449 if( i_fullscreen_change )
451 InitTextures( p_vout );
454 if( p_sys->p_vout->pf_unlock )
456 p_sys->p_vout->pf_unlock( p_sys->p_vout );
459 // to align in real time in OPENGL
460 if (p_sys->p_vout->i_alignment != p_vout->i_alignment)
462 p_vout->i_changes |= VOUT_CROP_CHANGE; //to force change
463 p_sys->p_vout->i_alignment = p_vout->i_alignment;
466 /* forward signal that autoscale toggle has changed */
467 if (p_vout->i_changes & VOUT_SCALE_CHANGE )
469 p_vout->i_changes &= ~VOUT_SCALE_CHANGE;
471 p_sys->p_vout->i_changes |= VOUT_SCALE_CHANGE;
474 /* forward signal that scale has changed */
475 if (p_vout->i_changes & VOUT_ZOOM_CHANGE )
477 p_vout->i_changes &= ~VOUT_ZOOM_CHANGE;
479 p_sys->p_vout->i_changes |= VOUT_ZOOM_CHANGE;
486 /*****************************************************************************
487 * Render: render previously calculated output
488 *****************************************************************************/
489 static void Render( vout_thread_t *p_vout, picture_t *p_pic )
492 vout_sys_t *p_sys = p_vout->p_sys;
494 /* On Win32/GLX, we do this the usual way:
495 + Fill the buffer with new content,
496 + Reload the texture,
499 On OS X with VRAM or AGP texturing, the order has to be:
500 + Reload the texture,
501 + Fill the buffer with new content,
504 (Thanks to gcc from the Arstechnica forums for the tip)
506 Therefore, we have to use two buffers and textures. On Win32/GLX,
507 we reload the texture to be displayed and use it right away. On
508 OS X, we first render, then reload the texture to be used next
511 if( p_sys->p_vout->pf_lock &&
512 p_sys->p_vout->pf_lock( p_sys->p_vout ) )
514 msg_Warn( p_vout, "could not lock OpenGL provider" );
520 i_new_index = ( p_sys->i_index + 1 ) & 1;
523 /* Update the texture */
524 glBindTexture( VLCGL_TARGET, p_sys->p_textures[i_new_index] );
525 glTexSubImage2D( VLCGL_TARGET, 0, 0, 0,
526 p_vout->fmt_out.i_width,
527 p_vout->fmt_out.i_height,
528 VLCGL_FORMAT, VLCGL_TYPE, p_sys->pp_buffer[i_new_index] );
530 /* Bind to the previous texture for drawing */
531 glBindTexture( VLCGL_TARGET, p_sys->p_textures[p_sys->i_index] );
534 p_sys->i_index = i_new_index;
535 p_pic->p->p_pixels = p_sys->pp_buffer[p_sys->i_index];
538 /* Update the texture */
539 glTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0,
540 p_vout->fmt_out.i_width,
541 p_vout->fmt_out.i_height,
542 VLCGL_FORMAT, VLCGL_TYPE, p_sys->pp_buffer[0] );
545 if( p_sys->p_vout->pf_unlock )
547 p_sys->p_vout->pf_unlock( p_sys->p_vout );
551 /*****************************************************************************
552 * DisplayVideo: displays previously rendered output
553 *****************************************************************************/
554 static void DisplayVideo( vout_thread_t *p_vout, picture_t *p_pic )
557 vout_sys_t *p_sys = p_vout->p_sys;
558 float f_width, f_height, f_x, f_y;
560 if( p_sys->p_vout->pf_lock &&
561 p_sys->p_vout->pf_lock( p_sys->p_vout ) )
563 msg_Warn( p_vout, "could not lock OpenGL provider" );
567 /* glTexCoord works differently with GL_TEXTURE_2D and
568 GL_TEXTURE_RECTANGLE_EXT */
570 f_x = (float)p_vout->fmt_out.i_x_offset;
571 f_y = (float)p_vout->fmt_out.i_y_offset;
572 f_width = (float)p_vout->fmt_out.i_x_offset +
573 (float)p_vout->fmt_out.i_visible_width;
574 f_height = (float)p_vout->fmt_out.i_y_offset +
575 (float)p_vout->fmt_out.i_visible_height;
577 f_x = (float)p_vout->fmt_out.i_x_offset / p_sys->i_tex_width;
578 f_y = (float)p_vout->fmt_out.i_y_offset / p_sys->i_tex_height;
579 f_width = ( (float)p_vout->fmt_out.i_x_offset +
580 p_vout->fmt_out.i_visible_width ) / p_sys->i_tex_width;
581 f_height = ( (float)p_vout->fmt_out.i_y_offset +
582 p_vout->fmt_out.i_visible_height ) / p_sys->i_tex_height;
585 /* Why drawing here and not in Render()? Because this way, the
586 OpenGL providers can call pf_display to force redraw. Currently,
587 the OS X provider uses it to get a smooth window resizing */
589 glClear( GL_COLOR_BUFFER_BIT );
591 glEnable( VLCGL_TARGET );
592 glBegin( GL_POLYGON );
593 glTexCoord2f( f_x, f_y ); glVertex2f( -1.0, 1.0 );
594 glTexCoord2f( f_width, f_y ); glVertex2f( 1.0, 1.0 );
595 glTexCoord2f( f_width, f_height ); glVertex2f( 1.0, -1.0 );
596 glTexCoord2f( f_x, f_height ); glVertex2f( -1.0, -1.0 );
599 glDisable( VLCGL_TARGET );
601 p_sys->p_vout->pf_swap( p_sys->p_vout );
603 if( p_sys->p_vout->pf_unlock )
605 p_sys->p_vout->pf_unlock( p_sys->p_vout );
609 int GetAlignedSize( int i_size )
611 /* Return the nearest power of 2 */
613 while( i_result < i_size )
620 /*****************************************************************************
621 * Control: control facility for the vout
622 *****************************************************************************/
623 static int Control( vout_thread_t *p_vout, int i_query, va_list args )
625 vout_sys_t *p_sys = p_vout->p_sys;
627 if( p_sys->p_vout->pf_control )
628 return p_sys->p_vout->pf_control( p_sys->p_vout, i_query, args );
632 static int InitTextures( vout_thread_t *p_vout )
634 vout_sys_t *p_sys = p_vout->p_sys;
637 glDeleteTextures( 2, p_sys->p_textures );
638 glGenTextures( 2, p_sys->p_textures );
640 for( i_index = 0; i_index < 2; i_index++ )
642 glBindTexture( VLCGL_TARGET, p_sys->p_textures[i_index] );
644 /* Set the texture parameters */
645 glTexParameterf( VLCGL_TARGET, GL_TEXTURE_PRIORITY, 1.0 );
647 glTexParameteri( VLCGL_TARGET, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
648 glTexParameteri( VLCGL_TARGET, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
650 glTexParameteri( VLCGL_TARGET, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
651 glTexParameteri( VLCGL_TARGET, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
653 glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
656 /* Tell the driver not to make a copy of the texture but to use
658 glEnable( GL_UNPACK_CLIENT_STORAGE_APPLE );
659 glPixelStorei( GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE );
662 /* Use VRAM texturing */
663 glTexParameteri( VLCGL_TARGET, GL_TEXTURE_STORAGE_HINT_APPLE,
664 GL_STORAGE_CACHED_APPLE );
666 /* Use AGP texturing */
667 glTexParameteri( VLCGL_TARGET, GL_TEXTURE_STORAGE_HINT_APPLE,
668 GL_STORAGE_SHARED_APPLE );
672 /* Call glTexImage2D only once, and use glTexSubImage2D later */
673 glTexImage2D( VLCGL_TARGET, 0, 3, p_sys->i_tex_width,
674 p_sys->i_tex_height, 0, VLCGL_FORMAT, VLCGL_TYPE,
675 p_sys->pp_buffer[i_index] );
681 /*****************************************************************************
682 * SendEvents: forward mouse and keyboard events to the parent p_vout
683 *****************************************************************************/
684 static int SendEvents( vlc_object_t *p_this, char const *psz_var,
685 vlc_value_t oldval, vlc_value_t newval, void *_p_vout )
687 VLC_UNUSED(p_this); VLC_UNUSED(oldval);
688 return var_Set( (vlc_object_t *)_p_vout, psz_var, newval );