- float f_width, f_height, f_x, f_y;
-
- if( p_sys->p_vout->pf_lock &&
- p_sys->p_vout->pf_lock( p_sys->p_vout ) )
- {
- msg_Warn( p_vout, "could not lock OpenGL provider" );
- return;
- }
-
- /* glTexCoord works differently with GL_TEXTURE_2D and
- GL_TEXTURE_RECTANGLE_EXT */
-#ifdef __APPLE__
- f_x = (float)p_vout->fmt_out.i_x_offset;
- f_y = (float)p_vout->fmt_out.i_y_offset;
- f_width = (float)p_vout->fmt_out.i_x_offset +
- (float)p_vout->fmt_out.i_visible_width;
- f_height = (float)p_vout->fmt_out.i_y_offset +
- (float)p_vout->fmt_out.i_visible_height;
-#else
- f_x = (float)p_vout->fmt_out.i_x_offset / p_sys->i_tex_width;
- f_y = (float)p_vout->fmt_out.i_y_offset / p_sys->i_tex_height;
- f_width = ( (float)p_vout->fmt_out.i_x_offset +
- p_vout->fmt_out.i_visible_width ) / p_sys->i_tex_width;
- f_height = ( (float)p_vout->fmt_out.i_y_offset +
- p_vout->fmt_out.i_visible_height ) / p_sys->i_tex_height;
-#endif
-
- /* 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
-#ifdef OPENGL_MORE_EFFECT
- if ((p_sys->i_effect > OPENGL_EFFECT_TRANSPARENT_CUBE) ||
- ((p_sys->i_effect == OPENGL_EFFECT_NONE)))
- {
- unsigned int i_i, i_j;
- unsigned int i_accuracy = config_GetInt( p_vout, "opengl-accuracy");
- unsigned int i_n = pow(2, i_accuracy);
- unsigned int i_n_x = (p_vout->fmt_out.i_visible_width / (i_n * 2));
- unsigned int i_n_y = (p_vout->fmt_out.i_visible_height / i_n);
- double d_x, d_y;
- int i_distortion = p_sys->i_effect;
- float f_p = p_sys->f_radius;
-
- glEnable( VLCGL_TARGET );
- glBegin(GL_QUADS);
- for (i_i = 0; i_i < p_vout->fmt_out.i_visible_width; i_i += i_n_x)
- {
- if ( i_i == i_n_x * i_n / 2) i_n_x += p_vout->fmt_out.i_visible_width % i_n;
- if ((i_i == (p_vout->fmt_out.i_visible_width / i_n) * i_n / 2 + i_n_x) &&
- (p_vout->fmt_out.i_visible_width / i_n != i_n_x))
- i_n_x -= p_vout->fmt_out.i_visible_width % i_n;
-
- int i_m;
- int i_index_max = 0;
-
- for (i_j = 0; i_j < p_vout->fmt_out.i_visible_height; i_j += i_n_y)
- {
- if ( i_j == i_n_y * i_n / 2) i_n_y += p_vout->fmt_out.i_visible_height % i_n;
- if ((i_j == (p_vout->fmt_out.i_visible_height / i_n) * i_n / 2 + i_n_y) &&
- (p_vout->fmt_out.i_visible_height / i_n != i_n_y))
- i_n_y -= p_vout->fmt_out.i_visible_height % i_n;
-
- for (i_m = i_index_max; i_m < i_index_max + 4; i_m++)
- {
- int i_k = ((i_m % 4) == 1) || ((i_m % 4) == 2);
- int i_l = ((i_m % 4) == 2) || ((i_m % 4) == 3);
-
- Transform(f_p, i_distortion, f_width, f_height, i_i + i_k * i_n_x, i_j + i_l * i_n_y, p_vout->fmt_out.i_visible_width, p_vout->fmt_out.i_visible_height, &d_x, &d_y);
- glTexCoord2f(f_x + d_x, f_y + d_y);
- d_x = - 1.0 + 2.0 * ((double)(i_k * i_n_x + i_i) / (double)p_vout->fmt_out.i_visible_width);
- d_y = 1.0 - 2.0 * (((double)i_l * i_n_y + i_j) / (double)p_vout->fmt_out.i_visible_height);
- glVertex3f((float)d_x, (float)d_y, Z_Compute(f_p, i_distortion, (float)d_x, (float)d_y));
- }
- }
- }
- glEnd();
- }
- else
-#endif
- {
- 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 );
- }
-}