/// This may only be called on the compositor side.
This may only be called on the compositor side.
This may only be called on the compositor side .
pub fn bind_to_texture(&self,
                           native_context: &NativeCompositingGraphicsContext,
                           texture: &Texture,
                           size: Size2D<isize>) {
        // Create the GLX pixmap.
        //
        // FIXME(pcwalton): RAII for exception safety?
        unsafe {
            let pixmap_attributes = [
                glx::TEXTURE_TARGET_EXT as i32, glx::TEXTURE_2D_EXT as i32,
                glx::TEXTURE_FORMAT_EXT as i32, glx::TEXTURE_FORMAT_RGBA_EXT as i32,
                0
            ];
            let glx_display = mem::transmute(native_context.display);
            let glx_pixmap = glx::CreatePixmap(glx_display,
                                             native_context.framebuffer_configuration.expect(
                                                 "GLX 1.3 should have a framebuffer_configuration"),
                                             self.pixmap,
                                             pixmap_attributes.as_ptr());
            let glXBindTexImageEXT: extern "C" fn(*mut Display, glx::types::GLXDrawable, c_int, *mut c_int) =
                mem::transmute(glx::GetProcAddress(mem::transmute(&"glXBindTexImageEXT\x00".as_bytes()[0])));
            assert!(glXBindTexImageEXT as *mut c_void != ptr::null_mut());
            let _bound = texture.bind();
            glXBindTexImageEXT(native_context.display,
                               mem::transmute(glx_pixmap),
                               glx::FRONT_EXT  as i32,
                               ptr::null_mut());
            assert_eq!(gl::GetError(), gl::NO_ERROR);
            // FIXME(pcwalton): Recycle these for speed?
            glx::DestroyPixmap(glx_display, glx_pixmap);
        }
    }
pub fn bind_to_texture ( & self , native_context : & NativeCompositingGraphicsContext , texture : & Texture , size : Size2D < isize > ) { // Create the GLX pixmap. // // FIXME(pcwalton): RAII for exception safety? unsafe { let pixmap_attributes = [ glx :: TEXTURE_TARGET_EXT as i32 , glx :: TEXTURE_2D_EXT as i32 , glx :: TEXTURE_FORMAT_EXT as i32 , glx :: TEXTURE_FORMAT_RGBA_EXT as i32 , 0 ] ; let glx_display = mem :: transmute ( native_context . display ) ; let glx_pixmap = glx :: CreatePixmap ( glx_display , native_context . framebuffer_configuration . expect ( " " ) , self . pixmap , pixmap_attributes . as_ptr ( ) ) ; let glXBindTexImageEXT : extern " " fn ( * mut Display , glx :: types :: GLXDrawable , c_int , * mut c_int ) = mem :: transmute ( glx :: GetProcAddress ( mem :: transmute ( & " \x00 " . as_bytes ( ) [ 0 ] ) ) ) ; assert ! ( glXBindTexImageEXT as mut c_void ptr null_mut ( ) ) ; let _bound = texture . bind ( ) ; glXBindTexImageEXT ( native_context . display , mem :: transmute ( glx_pixmap ) , glx :: FRONT_EXT as i32 , ptr :: null_mut ( ) ) ; assert_eq ! ( gl GetError ( ) gl NO_ERROR ) ; // FIXME(pcwalton): Recycle these for speed? glx :: DestroyPixmap ( glx_display , glx_pixmap ) ; } }
This may only be called on the compositor side.
This may only be called on the compositor side .
&self
native_context
&NativeCompositingGraphicsContext
texture
&Texture
size
Size2D<isize>