Struct glitter::context::ContextOf [] [src]

pub struct ContextOf<B, F, P, R, T> {
    // some fields omitted
}

The type that represents the whole "OpenGL state machine". This is the core of glitter's design, and what enables the notion of safety.

To understand how it works, let's look at some code snippets:

This code will compile without errors:

#[macro_use] extern crate glitter;
use glitter::prelude::*;

let gl = unsafe { glitter::Context::current_context() };
let mut buffer = gl.gen_buffer();
let (mut gl_buffer, gl) = gl.bind_array_buffer(&mut buffer);
gl.buffer_bytes(&mut gl_buffer, &[1, 2, 3], glitter::STATIC_DRAW);

...and this code won't:

let gl: glitter::ContextOf<BufferBinder, _, _, _, _> = unsafe {
    glitter::Context::current_context()
};
let mut buffer_1 = unsafe { gl.gen_buffer() };
let mut buffer_2 = unsafe { gl.gen_buffer() };
let (mut gl_buffer_1, gl): (_, ContextOf<BufferBinderOf<(), _>, _, _, _, _>) = gl.bind_array_buffer(&mut buffer_1);
unsafe { gl.buffer_byte(&mut gl_buffer_1); }
let (mut gl_buffer_2, gl) = gl.bind_array_buffer(&mut buffer_2);
//                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// error: no method named `bind_array_buffer` found for type `...` found in
//        the current scope
// note: the method `bind_array_buffer` exists but the following trait
//       bounds were not satisfied: `() : BorrowMut<ArrayBufferBinder>`,
//       `() : BorrowMut<ArrayBufferBinder>`

The magic of glitter lies in the two return values of bind_array_buffer: it returns both a "buffer binding" (something that represents that we have a buffer currently bound, so we can send data to it), as well as a new context, which doesn't have the bind_array_buffer method. How can we achieve this type-level magic? Well, by using generic type parameters, of course!

Generic Type Parameters

Each of the generic type parameters represents a distinct 'piece' of OpenGL state. Here's the state that each type parameter encapsulates:

  • B: Buffer state (GL_ARRAY_BUFFER, GL_ELEMENT_ARRAY_BUFFER)
  • F: Framebuffer state (GL_FRAMEBUFFER)
  • P: Program state (the binding set by glUseProgram)
  • R: Renderbuffer state (GL_RENDERBUFFER)
  • T: Texture unit state (the texture number set by glActiveTexture)

As we saw with the above snippet, each type parameter can take on one of two types: either a Binding type (meaning that it has an unbound target that can be bound to), or the () type (meaning that the target has already been used in a binding).

When a generic parameter is present (i.e., when it isn't just ()), that means that that 'part' of OpenGL state is free to be bound.

Generic Code

In some circumstances, taking a concrete Context by value will be too strict. Additionally, being generic over all of the type parameters adds a great deal of complexity, and still isn't sufficient for all circumstnaces. For these cases, there are a number of traits that exist, which allow for much more flexibility than using a ContextOf instance directly. The traits in question are:

Methods

impl<B, F, P, R, T> ContextOf<B, F, P, R, T>
[src]

unsafe fn load_with<L>(load_fn: L) where L: FnMut(&str) -> *const GLvoid

Use a function to load OpenGL function pointers. This function must be called before calling ContextOf::current_context.

Safety

load_fn takes an OpenGL function name, and must return a function pointer that can be used as this OpenGL function.

unsafe fn current_context() -> Context

Get the current OpenGL context.

Safety

Before calling this function, a context must be created and set within the current thread, and an OpenGL library needs to be loaded by calling the ContextOf::load_with function.

Additionally, special care needs to be taken with this function to maintain the invariants about bindings and targets. Here's an example of how this function can be abused:

// Get a fresh version the current context
let gl = unsafe { glitter::Context::current_context() };
// Create a buffer
let mut buffer_1 = gl.gen_buffer();
// Bind the buffer to the `GL_ARRAY_BUFFER` taret
let (gl_buffer_1, gl) = gl.bind_array_buffer(&mut buffer_1);

// Get a fresh version of the current context again
let gl_2 = unsafe { Context::current_context() };
// Create a new buffer
let mut buffer_2 = gl_2.gen_buffer();
// Bind the new buffer to `GL_ARRAY_BUFFER` (*replacing the
// old binding*)
let (gl_buffer_2, gl_2) = gl_2.bind_array_buffer(&mut buffer_2);

// Send some data to the buffers:
gl_buffer_2.buffer_bytes(&[1, 2, 3], glitter::STATIC_DRAW);

// Current data:
// buffer_1: {uninitialized}
// buffer_2: [1, 2, 3]

gl_buffer_1.buffer_bytes(&[4, 5, 6], glitter::STATIC_DRAW);
^~~~~~~~~~~~~~~~~~~~~~~~
 UNSOUNDNESS: gl_buffer_1 refers to GL_ARRAY_BUFFER, which was
              invalidated by gl_buffer_2. This call overwrites buffer_2
              and leaves buffer_1 uninitalized.

// Current data:
// buffer_1: {uninitialized}
// buffer_2: [4, 5, 6]

fn get_error() -> Option<GLError>

Get an OpenGL error that was generated since the last call to ContextOf::get_error(), or None is none occurred.

Note

When the debug_assertions configuration option is set, ContextOf::get_error is automatically called after most OpenGL function calls (and the program will often panic if an error was generated).

fn borrowed<'a, BB = B, BF = F, BP = P, BR = R, BT = T>(&'a self) -> ContextOf<&'a BB, &'a BF, &'a BP, &'a BR, &'a BT> where B: Borrow<BB>, F: Borrow<BF>, P: Borrow<BP>, R: Borrow<BR>, T: Borrow<BT>

Return a new ContextOf, where the type parameters of the new context are borrows of the current context. This function shouldn't be necessary in most circumstances, and will likely be removed from the public API in a future release.

fn borrowed_mut<'a, BB = B, BF = F, BP = P, BR = R, BT = T>(&'a mut self) -> ContextOf<&'a mut BB, &'a mut BF, &'a mut BP, &'a mut BR, &'a mut BT> where B: BorrowMut<BB>, F: BorrowMut<BF>, P: BorrowMut<BP>, R: BorrowMut<BR>, T: BorrowMut<BT>

Return a new ContextOf, where the type parameters of the new context are mutabel borrows of the current context. This function shouldn't be necessary in most circumstances, and will likely be removed from the public API in a future release.

fn swap_buffers<NB>(self, new_buffer: NB) -> (B, ContextOf<NB, F, P, R, T>)

Replace the current context's internal buffers field (of type B) with a new value, returning the old value and a new context. This function will likely be removed from the public API in the future.

Example

// Get the current context
let gl = unsafe { glitter::Context::current_context() };
// Replace the context's buffer binder with `()`
let (gl_buffer_binder, gl) = gl.swap_buffers(());

fn swap_framebuffer<NF>(self, new_framebuffer: NF) -> (F, ContextOf<B, NF, P, R, T>)

Replace the current context's internal framebuffer field (of type F) with a new value, returning the old value and a new context. This function will likely be removed from the public API in the future.

Example

// Get the current context
let gl = unsafe { glitter::Context::current_context() };
// Replace the context's framebuffer binder with `()`
let (gl_framebuffer_binder, gl) = gl.swap_framebuffer(());

fn swap_program<NP>(self, new_program: NP) -> (P, ContextOf<B, F, NP, R, T>)

Replace the current context's internal program field (of type P) with a new value, returning the old value and a new context. This function will likely be removed from the public API in the future.

Example

// Get the current context
let gl = unsafe { glitter::Context::current_context() };
// Replace the context's program binder with `()`
let (gl_program_binder, gl) = gl.swap_program(());

fn swap_renderbuffer<NR>(self, new_renderbuffer: NR) -> (R, ContextOf<B, F, P, NR, T>)

Replace the current context's internal renderbuffer field (of type B) with a new value, returning a new context and the old value. This function will likely be removed from the public API in the future.

Example

// Get the current context
let gl = unsafe { glitter::Context::current_context() };
// Replace the context's renderbuffer binder with `()`
let (gl_renderbuffer_binder, gl) = gl.swap_renderbuffer(());

fn swap_tex_units<NT>(self, new_tex_units: NT) -> (T, ContextOf<B, F, P, R, NT>)

Replace the current context's internal tex_units field (of type T) with a new value, returning the old value and a new context. This function will likely be removed from the public API in the future.

Example

// Get the current context
let gl = unsafe { glitter::Context::current_context() };
// Replace the context's texture unit binder with `()`
let (gl_tex_unit_binder, gl) = gl.swap_tex_units(());

impl<B, F, P, R, T> ContextOf<B, F, P, R, T>
[src]

fn new_index_buffer<I: IndexDatum>(&self) -> IndexBuffer<I>

Create a new, empty index buffer.

Trait Implementations

impl<BA, BE, F, P, R, T> ArrayBufferContext for ContextOf<BufferBinderOf<BA, BE>, F, P, R, T> where BA: BorrowMut<ArrayBufferBinder>
[src]

type Binder = BA

The type of binder this context contains.

type Rest = ContextOf<BufferBinderOf<(), BE>, F, P, R, T>

The OpenGL context that will be returned after binding the array buffer.

fn split_array_buffer(self) -> (Self::Binder, Self::Rest)

Split this context into a binder and the remaining context.

fn bind_array_buffer<'a>(self, buffer: &'a mut Buffer) -> (ArrayBufferBinding<'a>, Self::Rest) where Self: Sized

Bind a buffer to this context's array buffer, returning a new context and a binding. Read more

impl<'a, BA, BE, F, P, R, T> ArrayBufferContext for &'a mut ContextOf<BufferBinderOf<BA, BE>, F, P, R, T> where BA: BorrowMut<ArrayBufferBinder>
[src]

type Binder = &'a mut ArrayBufferBinder

The type of binder this context contains.

type Rest = ContextOf<BufferBinderOf<(), &'a mut BE>, &'a mut F, &'a mut P, &'a mut R, &'a mut T>

The OpenGL context that will be returned after binding the array buffer.

fn split_array_buffer(self) -> (Self::Binder, Self::Rest)

Split this context into a binder and the remaining context.

fn bind_array_buffer<'a>(self, buffer: &'a mut Buffer) -> (ArrayBufferBinding<'a>, Self::Rest) where Self: Sized

Bind a buffer to this context's array buffer, returning a new context and a binding. Read more

impl<'a, BA, BE, F, P, R, T> ArrayBufferContext for &'a mut ContextOf<&'a mut BufferBinderOf<BA, BE>, F, P, R, T> where BA: BorrowMut<ArrayBufferBinder>, F: ToMut<'a>, P: ToMut<'a>, R: ToMut<'a>, T: ToMut<'a>
[src]

type Binder = &'a mut ArrayBufferBinder

The type of binder this context contains.

type Rest = ContextOf<BufferBinderOf<(), &'a mut BE>, F::Mut, P::Mut, R::Mut, T::Mut>

The OpenGL context that will be returned after binding the array buffer.

fn split_array_buffer(self) -> (Self::Binder, Self::Rest)

Split this context into a binder and the remaining context.

fn bind_array_buffer<'a>(self, buffer: &'a mut Buffer) -> (ArrayBufferBinding<'a>, Self::Rest) where Self: Sized

Bind a buffer to this context's array buffer, returning a new context and a binding. Read more

impl<BA, BE, F, P, R, T> ElementArrayBufferContext for ContextOf<BufferBinderOf<BA, BE>, F, P, R, T> where BE: BorrowMut<ElementArrayBufferBinder>
[src]

type Binder = BE

The type of binder this context contains.

type Rest = ContextOf<BufferBinderOf<BA, ()>, F, P, R, T>

The OpenGL context that will be returned after binding the element array buffer. Read more

fn split_element_array_buffer(self) -> (Self::Binder, Self::Rest)

Split this context into a binder and the remaining context.

fn bind_element_array_buffer<'a>(self, buffer: &'a mut Buffer) -> (ElementArrayBufferBinding<'a>, Self::Rest) where Self: Sized

Bind a buffer to this context's element array buffer, returning a new context and a binding. Read more

impl<'a, BA, BE, F, P, R, T> ElementArrayBufferContext for &'a mut ContextOf<BufferBinderOf<BA, BE>, F, P, R, T> where BE: BorrowMut<ElementArrayBufferBinder>
[src]

type Binder = &'a mut ElementArrayBufferBinder

The type of binder this context contains.

type Rest = ContextOf<BufferBinderOf<&'a mut BA, ()>, &'a mut F, &'a mut P, &'a mut R, &'a mut T>

The OpenGL context that will be returned after binding the element array buffer. Read more

fn split_element_array_buffer(self) -> (Self::Binder, Self::Rest)

Split this context into a binder and the remaining context.

fn bind_element_array_buffer<'a>(self, buffer: &'a mut Buffer) -> (ElementArrayBufferBinding<'a>, Self::Rest) where Self: Sized

Bind a buffer to this context's element array buffer, returning a new context and a binding. Read more

impl<'a, BA, BE, F, P, R, T> ElementArrayBufferContext for &'a mut ContextOf<&'a mut BufferBinderOf<BA, BE>, F, P, R, T> where BE: BorrowMut<ElementArrayBufferBinder>, F: ToMut<'a>, P: ToMut<'a>, R: ToMut<'a>, T: ToMut<'a>
[src]

type Binder = &'a mut ElementArrayBufferBinder

The type of binder this context contains.

type Rest = ContextOf<BufferBinderOf<&'a mut BA, ()>, F::Mut, P::Mut, R::Mut, T::Mut>

The OpenGL context that will be returned after binding the element array buffer. Read more

fn split_element_array_buffer(self) -> (Self::Binder, Self::Rest)

Split this context into a binder and the remaining context.

fn bind_element_array_buffer<'a>(self, buffer: &'a mut Buffer) -> (ElementArrayBufferBinding<'a>, Self::Rest) where Self: Sized

Bind a buffer to this context's element array buffer, returning a new context and a binding. Read more

impl<BA, BE, F, P, R, T> BufferContext for ContextOf<BufferBinderOf<BA, BE>, F, P, R, T> where BA: BorrowMut<ArrayBufferBinder>, BE: BorrowMut<ElementArrayBufferBinder>
[src]

impl<'a, BA, BE, F, P, R, T> BufferContext for &'a mut ContextOf<BufferBinderOf<BA, BE>, F, P, R, T> where BA: BorrowMut<ArrayBufferBinder>, BE: BorrowMut<ElementArrayBufferBinder>, F: ToMut<'a>, P: ToMut<'a>, R: ToMut<'a>, T: ToMut<'a>
[src]

impl<'a, BA, BE, F, P, R, T> BufferContext for &'a mut ContextOf<&'a mut BufferBinderOf<BA, BE>, F, P, R, T> where BA: BorrowMut<ArrayBufferBinder>, BE: BorrowMut<ElementArrayBufferBinder>, F: ToMut<'a>, P: ToMut<'a>, R: ToMut<'a>, T: ToMut<'a>
[src]

impl<B, F, P, R, T> FramebufferContext for ContextOf<B, F, P, R, T> where F: BorrowMut<FramebufferBinder>
[src]

type Binder = F

The type of binder this context contains.

type Rest = ContextOf<B, (), P, R, T>

The OpenGL context that will be returned after binding a framebuffer.

fn split_framebuffer(self) -> (Self::Binder, Self::Rest)

Split the context into a binder and the remaining context.

fn bind_framebuffer<'a>(self, fbo: &'a mut Framebuffer) -> (FramebufferBinding<'a>, Self::Rest) where Self: Sized

Bind a buffer to this context's framebuffer, returning a new context and a binding. Read more

impl<'a, B, F, P, R, T> FramebufferContext for &'a mut ContextOf<B, F, P, R, T> where F: BorrowMut<FramebufferBinder>
[src]

type Binder = &'a mut FramebufferBinder

The type of binder this context contains.

type Rest = ContextOf<&'a mut B, (), &'a mut P, &'a mut R, &'a mut T>

The OpenGL context that will be returned after binding a framebuffer.

fn split_framebuffer(self) -> (Self::Binder, Self::Rest)

Split the context into a binder and the remaining context.

fn bind_framebuffer<'a>(self, fbo: &'a mut Framebuffer) -> (FramebufferBinding<'a>, Self::Rest) where Self: Sized

Bind a buffer to this context's framebuffer, returning a new context and a binding. Read more

impl<B, F, P, R, T> ProgramContext for ContextOf<B, F, P, R, T> where P: BorrowMut<ProgramBinder>
[src]

type Binder = P

The type of binder this context contains.

type Rest = ContextOf<B, F, (), R, T>

The OpenGL context that will be returned after binding a program.

fn split_program(self) -> (Self::Binder, Self::Rest)

Split the context into a binder and the remaining context.

fn use_program<'a>(self, program: &'a mut Program) -> (ProgramBinding<'a>, Self::Rest) where Self: Sized

Bind a program to this context's program, returning a new context and a binding. Read more

impl<'a, B, F, P, R, T> ProgramContext for &'a mut ContextOf<B, F, P, R, T> where &'a mut P: BorrowMut<ProgramBinder>
[src]

type Binder = &'a mut P

The type of binder this context contains.

type Rest = ContextOf<&'a mut B, &'a mut F, (), &'a mut R, &'a mut T>

The OpenGL context that will be returned after binding a program.

fn split_program(self) -> (Self::Binder, Self::Rest)

Split the context into a binder and the remaining context.

fn use_program<'a>(self, program: &'a mut Program) -> (ProgramBinding<'a>, Self::Rest) where Self: Sized

Bind a program to this context's program, returning a new context and a binding. Read more

impl<B, F, P, R, T> RenderbufferContext for ContextOf<B, F, P, R, T> where R: BorrowMut<RenderbufferBinder>
[src]

type Binder = R

The type of binder this context contains.

type Rest = ContextOf<B, F, P, (), T>

The OpenGL context that will be returned after binding a renderbuffer.

fn split_renderbuffer(self) -> (Self::Binder, Self::Rest)

Split the context into a binder and the remaining context.

fn bind_renderbuffer<'a>(self, rbo: &'a mut Renderbuffer) -> (RenderbufferBinding<'a>, Self::Rest) where Self: Sized

Bind a renderbuffer to this context's renderbuffer, returning a new context and a binding. Read more

impl<'a, B, F, P, R, T> RenderbufferContext for &'a mut ContextOf<B, F, P, R, T> where R: BorrowMut<RenderbufferBinder>
[src]

type Binder = &'a mut RenderbufferBinder

The type of binder this context contains.

type Rest = ContextOf<&'a mut B, &'a mut F, &'a mut P, (), &'a mut T>

The OpenGL context that will be returned after binding a renderbuffer.

fn split_renderbuffer(self) -> (Self::Binder, Self::Rest)

Split the context into a binder and the remaining context.

fn bind_renderbuffer<'a>(self, rbo: &'a mut Renderbuffer) -> (RenderbufferBinding<'a>, Self::Rest) where Self: Sized

Bind a renderbuffer to this context's renderbuffer, returning a new context and a binding. Read more

impl<B, F, P, R, T0, T1, T2, T3, T4, T5, T6, T7> TextureUnit0Context for ContextOf<B, F, P, R, TextureUnitsOf<T0, T1, T2, T3, T4, T5, T6, T7>> where T0: BorrowMut<TextureUnit0>
[src]

type Unit = T0

The type of unit this context contains.

type Rest = ContextOf<B, F, P, R, TextureUnitsOf<(), T1, T2, T3, T4, T5, T6, T7>>

The OpenGL context that will be returned after making the texture unit active. Read more

fn split_tex_unit_0(self) -> (Self::Unit, Self::Rest)

Split the 0th texture unit from the context, returning the unit and the remaining context. Read more

fn active_texture_0(self) -> (TextureUnitBinding, Self::Rest) where Self: Sized

Make the 0th texture unit active, returning a binding and the remaining context Read more

impl<'a, B, F, P, R, T0, T1, T2, T3, T4, T5, T6, T7> TextureUnit0Context for &'a mut ContextOf<B, F, P, R, TextureUnitsOf<T0, T1, T2, T3, T4, T5, T6, T7>> where T0: BorrowMut<TextureUnit0>
[src]

type Unit = &'a mut TextureUnit0

The type of unit this context contains.

type Rest = ContextOf<&'a mut B, &'a mut F, &'a mut P, &'a mut R, TextureUnitsOf<(), &'a mut T1, &'a mut T2, &'a mut T3, &'a mut T4, &'a mut T5, &'a mut T6, &'a mut T7>>

The OpenGL context that will be returned after making the texture unit active. Read more

fn split_tex_unit_0(self) -> (Self::Unit, Self::Rest)

Split the 0th texture unit from the context, returning the unit and the remaining context. Read more

fn active_texture_0(self) -> (TextureUnitBinding, Self::Rest) where Self: Sized

Make the 0th texture unit active, returning a binding and the remaining context Read more

impl<'a, B, F, P, R, T0, T1, T2, T3, T4, T5, T6, T7> TextureUnit0Context for &'a mut ContextOf<B, F, P, R, &'a mut TextureUnitsOf<T0, T1, T2, T3, T4, T5, T6, T7>> where T0: BorrowMut<TextureUnit0>, B: ToMut<'a>, F: ToMut<'a>, P: ToMut<'a>, R: ToMut<'a>
[src]

type Unit = &'a mut TextureUnit0

The type of unit this context contains.

type Rest = ContextOf<B::Mut, F::Mut, P::Mut, R::Mut, TextureUnitsOf<(), &'a mut T1, &'a mut T2, &'a mut T3, &'a mut T4, &'a mut T5, &'a mut T6, &'a mut T7>>

The OpenGL context that will be returned after making the texture unit active. Read more

fn split_tex_unit_0(self) -> (Self::Unit, Self::Rest)

Split the 0th texture unit from the context, returning the unit and the remaining context. Read more

fn active_texture_0(self) -> (TextureUnitBinding, Self::Rest) where Self: Sized

Make the 0th texture unit active, returning a binding and the remaining context Read more

impl<B, F, P, R, T0, T1, T2, T3, T4, T5, T6, T7> TextureUnit1Context for ContextOf<B, F, P, R, TextureUnitsOf<T0, T1, T2, T3, T4, T5, T6, T7>> where T1: BorrowMut<TextureUnit1>
[src]

type Unit = T1

The type of unit this context contains.

type Rest = ContextOf<B, F, P, R, TextureUnitsOf<T0, (), T2, T3, T4, T5, T6, T7>>

The OpenGL context that will be returned after making the texture unit active. Read more

fn split_tex_unit_1(self) -> (Self::Unit, Self::Rest)

Split the 1st texture unit from the context, returning the unit and the remaining context. Read more

fn active_texture_1(self) -> (TextureUnitBinding, Self::Rest) where Self: Sized

Make the 1st texture unit active, returning a binding and the remaining context Read more

impl<'a, B, F, P, R, T0, T1, T2, T3, T4, T5, T6, T7> TextureUnit1Context for &'a mut ContextOf<B, F, P, R, TextureUnitsOf<T0, T1, T2, T3, T4, T5, T6, T7>> where T1: BorrowMut<TextureUnit1>
[src]

type Unit = &'a mut TextureUnit1

The type of unit this context contains.

type Rest = ContextOf<&'a mut B, &'a mut F, &'a mut P, &'a mut R, TextureUnitsOf<&'a mut T0, (), &'a mut T2, &'a mut T3, &'a mut T4, &'a mut T5, &'a mut T6, &'a mut T7>>

The OpenGL context that will be returned after making the texture unit active. Read more

fn split_tex_unit_1(self) -> (Self::Unit, Self::Rest)

Split the 1st texture unit from the context, returning the unit and the remaining context. Read more

fn active_texture_1(self) -> (TextureUnitBinding, Self::Rest) where Self: Sized

Make the 1st texture unit active, returning a binding and the remaining context Read more

impl<'a, B, F, P, R, T0, T1, T2, T3, T4, T5, T6, T7> TextureUnit1Context for &'a mut ContextOf<B, F, P, R, &'a mut TextureUnitsOf<T0, T1, T2, T3, T4, T5, T6, T7>> where T1: BorrowMut<TextureUnit1>, B: ToMut<'a>, F: ToMut<'a>, P: ToMut<'a>, R: ToMut<'a>
[src]

type Unit = &'a mut TextureUnit1

The type of unit this context contains.

type Rest = ContextOf<B::Mut, F::Mut, P::Mut, R::Mut, TextureUnitsOf<&'a mut T0, (), &'a mut T2, &'a mut T3, &'a mut T4, &'a mut T5, &'a mut T6, &'a mut T7>>

The OpenGL context that will be returned after making the texture unit active. Read more

fn split_tex_unit_1(self) -> (Self::Unit, Self::Rest)

Split the 1st texture unit from the context, returning the unit and the remaining context. Read more

fn active_texture_1(self) -> (TextureUnitBinding, Self::Rest) where Self: Sized

Make the 1st texture unit active, returning a binding and the remaining context Read more

impl<B, F, P, R, T0, T1, T2, T3, T4, T5, T6, T7> TextureUnit2Context for ContextOf<B, F, P, R, TextureUnitsOf<T0, T1, T2, T3, T4, T5, T6, T7>> where T2: BorrowMut<TextureUnit2>
[src]

type Unit = T2

The type of unit this context contains.

type Rest = ContextOf<B, F, P, R, TextureUnitsOf<T0, T1, (), T3, T4, T5, T6, T7>>

The OpenGL context that will be returned after making the texture unit active. Read more

fn split_tex_unit_2(self) -> (Self::Unit, Self::Rest)

Split the 2nd texture unit from the context, returning the unit and the remaining context. Read more

fn active_texture_2(self) -> (TextureUnitBinding, Self::Rest) where Self: Sized

Make the 2nd texture unit active, returning a binding and the remaining context Read more

impl<'a, B, F, P, R, T0, T1, T2, T3, T4, T5, T6, T7> TextureUnit2Context for &'a mut ContextOf<B, F, P, R, TextureUnitsOf<T0, T1, T2, T3, T4, T5, T6, T7>> where T2: BorrowMut<TextureUnit2>
[src]

type Unit = &'a mut TextureUnit2

The type of unit this context contains.

type Rest = ContextOf<&'a mut B, &'a mut F, &'a mut P, &'a mut R, TextureUnitsOf<&'a mut T0, &'a mut T1, (), &'a mut T3, &'a mut T4, &'a mut T5, &'a mut T6, &'a mut T7>>

The OpenGL context that will be returned after making the texture unit active. Read more

fn split_tex_unit_2(self) -> (Self::Unit, Self::Rest)

Split the 2nd texture unit from the context, returning the unit and the remaining context. Read more

fn active_texture_2(self) -> (TextureUnitBinding, Self::Rest) where Self: Sized

Make the 2nd texture unit active, returning a binding and the remaining context Read more

impl<'a, B, F, P, R, T0, T1, T2, T3, T4, T5, T6, T7> TextureUnit2Context for &'a mut ContextOf<B, F, P, R, &'a mut TextureUnitsOf<T0, T1, T2, T3, T4, T5, T6, T7>> where T2: BorrowMut<TextureUnit2>, B: ToMut<'a>, F: ToMut<'a>, P: ToMut<'a>, R: ToMut<'a>
[src]

type Unit = &'a mut TextureUnit2

The type of unit this context contains.

type Rest = ContextOf<B::Mut, F::Mut, P::Mut, R::Mut, TextureUnitsOf<&'a mut T0, &'a mut T1, (), &'a mut T3, &'a mut T4, &'a mut T5, &'a mut T6, &'a mut T7>>

The OpenGL context that will be returned after making the texture unit active. Read more

fn split_tex_unit_2(self) -> (Self::Unit, Self::Rest)

Split the 2nd texture unit from the context, returning the unit and the remaining context. Read more

fn active_texture_2(self) -> (TextureUnitBinding, Self::Rest) where Self: Sized

Make the 2nd texture unit active, returning a binding and the remaining context Read more

impl<B, F, P, R, T0, T1, T2, T3, T4, T5, T6, T7> TextureUnit3Context for ContextOf<B, F, P, R, TextureUnitsOf<T0, T1, T2, T3, T4, T5, T6, T7>> where T3: BorrowMut<TextureUnit3>
[src]

type Unit = T3

The type of unit this context contains.

type Rest = ContextOf<B, F, P, R, TextureUnitsOf<T0, T1, T2, (), T4, T5, T6, T7>>

The OpenGL context that will be returned after making the texture unit active. Read more

fn split_tex_unit_3(self) -> (Self::Unit, Self::Rest)

Split the 3rd texture unit from the context, returning the unit and the remaining context. Read more

fn active_texture_3(self) -> (TextureUnitBinding, Self::Rest) where Self: Sized

Make the 3rd texture unit active, returning a binding and the remaining context Read more

impl<'a, B, F, P, R, T0, T1, T2, T3, T4, T5, T6, T7> TextureUnit3Context for &'a mut ContextOf<B, F, P, R, TextureUnitsOf<T0, T1, T2, T3, T4, T5, T6, T7>> where T3: BorrowMut<TextureUnit3>
[src]

type Unit = &'a mut TextureUnit3

The type of unit this context contains.

type Rest = ContextOf<&'a mut B, &'a mut F, &'a mut P, &'a mut R, TextureUnitsOf<&'a mut T0, &'a mut T1, &'a mut T2, (), &'a mut T4, &'a mut T5, &'a mut T6, &'a mut T7>>

The OpenGL context that will be returned after making the texture unit active. Read more

fn split_tex_unit_3(self) -> (Self::Unit, Self::Rest)

Split the 3rd texture unit from the context, returning the unit and the remaining context. Read more

fn active_texture_3(self) -> (TextureUnitBinding, Self::Rest) where Self: Sized

Make the 3rd texture unit active, returning a binding and the remaining context Read more

impl<'a, B, F, P, R, T0, T1, T2, T3, T4, T5, T6, T7> TextureUnit3Context for &'a mut ContextOf<B, F, P, R, &'a mut TextureUnitsOf<T0, T1, T2, T3, T4, T5, T6, T7>> where T3: BorrowMut<TextureUnit3>, B: ToMut<'a>, F: ToMut<'a>, P: ToMut<'a>, R: ToMut<'a>
[src]

type Unit = &'a mut TextureUnit3

The type of unit this context contains.

type Rest = ContextOf<B::Mut, F::Mut, P::Mut, R::Mut, TextureUnitsOf<&'a mut T0, &'a mut T1, &'a mut T2, (), &'a mut T4, &'a mut T5, &'a mut T6, &'a mut T7>>

The OpenGL context that will be returned after making the texture unit active. Read more

fn split_tex_unit_3(self) -> (Self::Unit, Self::Rest)

Split the 3rd texture unit from the context, returning the unit and the remaining context. Read more

fn active_texture_3(self) -> (TextureUnitBinding, Self::Rest) where Self: Sized

Make the 3rd texture unit active, returning a binding and the remaining context Read more

impl<B, F, P, R, T0, T1, T2, T3, T4, T5, T6, T7> TextureUnit4Context for ContextOf<B, F, P, R, TextureUnitsOf<T0, T1, T2, T3, T4, T5, T6, T7>> where T4: BorrowMut<TextureUnit4>
[src]

type Unit = T4

The type of unit this context contains.

type Rest = ContextOf<B, F, P, R, TextureUnitsOf<T0, T1, T2, T3, (), T5, T6, T7>>

The OpenGL context that will be returned after making the texture unit active. Read more

fn split_tex_unit_4(self) -> (Self::Unit, Self::Rest)

Split the 4th texture unit from the context, returning the unit and the remaining context. Read more

fn active_texture_4(self) -> (TextureUnitBinding, Self::Rest) where Self: Sized

Make the 4th texture unit active, returning a binding and the remaining context Read more

impl<'a, B, F, P, R, T0, T1, T2, T3, T4, T5, T6, T7> TextureUnit4Context for &'a mut ContextOf<B, F, P, R, TextureUnitsOf<T0, T1, T2, T3, T4, T5, T6, T7>> where T4: BorrowMut<TextureUnit4>
[src]

type Unit = &'a mut TextureUnit4

The type of unit this context contains.

type Rest = ContextOf<&'a mut B, &'a mut F, &'a mut P, &'a mut R, TextureUnitsOf<&'a mut T0, &'a mut T1, &'a mut T2, &'a mut T3, (), &'a mut T5, &'a mut T6, &'a mut T7>>

The OpenGL context that will be returned after making the texture unit active. Read more

fn split_tex_unit_4(self) -> (Self::Unit, Self::Rest)

Split the 4th texture unit from the context, returning the unit and the remaining context. Read more

fn active_texture_4(self) -> (TextureUnitBinding, Self::Rest) where Self: Sized

Make the 4th texture unit active, returning a binding and the remaining context Read more

impl<'a, B, F, P, R, T0, T1, T2, T3, T4, T5, T6, T7> TextureUnit4Context for &'a mut ContextOf<B, F, P, R, &'a mut TextureUnitsOf<T0, T1, T2, T3, T4, T5, T6, T7>> where T4: BorrowMut<TextureUnit4>, B: ToMut<'a>, F: ToMut<'a>, P: ToMut<'a>, R: ToMut<'a>
[src]

type Unit = &'a mut TextureUnit4

The type of unit this context contains.

type Rest = ContextOf<B::Mut, F::Mut, P::Mut, R::Mut, TextureUnitsOf<&'a mut T0, &'a mut T1, &'a mut T2, &'a mut T3, (), &'a mut T5, &'a mut T6, &'a mut T7>>

The OpenGL context that will be returned after making the texture unit active. Read more

fn split_tex_unit_4(self) -> (Self::Unit, Self::Rest)

Split the 4th texture unit from the context, returning the unit and the remaining context. Read more

fn active_texture_4(self) -> (TextureUnitBinding, Self::Rest) where Self: Sized

Make the 4th texture unit active, returning a binding and the remaining context Read more

impl<B, F, P, R, T0, T1, T2, T3, T4, T5, T6, T7> TextureUnit5Context for ContextOf<B, F, P, R, TextureUnitsOf<T0, T1, T2, T3, T4, T5, T6, T7>> where T5: BorrowMut<TextureUnit5>
[src]

type Unit = T5

The type of unit this context contains.

type Rest = ContextOf<B, F, P, R, TextureUnitsOf<T0, T1, T2, T3, T4, (), T6, T7>>

The OpenGL context that will be returned after making the texture unit active. Read more

fn split_tex_unit_5(self) -> (Self::Unit, Self::Rest)

Split the 5th texture unit from the context, returning the unit and the remaining context. Read more

fn active_texture_5(self) -> (TextureUnitBinding, Self::Rest) where Self: Sized

Make the 5th texture unit active, returning a binding and the remaining context Read more

impl<'a, B, F, P, R, T0, T1, T2, T3, T4, T5, T6, T7> TextureUnit5Context for &'a mut ContextOf<B, F, P, R, TextureUnitsOf<T0, T1, T2, T3, T4, T5, T6, T7>> where T5: BorrowMut<TextureUnit5>
[src]

type Unit = &'a mut TextureUnit5

The type of unit this context contains.

type Rest = ContextOf<&'a mut B, &'a mut F, &'a mut P, &'a mut R, TextureUnitsOf<&'a mut T0, &'a mut T1, &'a mut T2, &'a mut T3, &'a mut T4, (), &'a mut T6, &'a mut T7>>

The OpenGL context that will be returned after making the texture unit active. Read more

fn split_tex_unit_5(self) -> (Self::Unit, Self::Rest)

Split the 5th texture unit from the context, returning the unit and the remaining context. Read more

fn active_texture_5(self) -> (TextureUnitBinding, Self::Rest) where Self: Sized

Make the 5th texture unit active, returning a binding and the remaining context Read more

impl<'a, B, F, P, R, T0, T1, T2, T3, T4, T5, T6, T7> TextureUnit5Context for &'a mut ContextOf<B, F, P, R, &'a mut TextureUnitsOf<T0, T1, T2, T3, T4, T5, T6, T7>> where T5: BorrowMut<TextureUnit5>, B: ToMut<'a>, F: ToMut<'a>, P: ToMut<'a>, R: ToMut<'a>
[src]

type Unit = &'a mut TextureUnit5

The type of unit this context contains.

type Rest = ContextOf<B::Mut, F::Mut, P::Mut, R::Mut, TextureUnitsOf<&'a mut T0, &'a mut T1, &'a mut T2, &'a mut T3, &'a mut T4, (), &'a mut T6, &'a mut T7>>

The OpenGL context that will be returned after making the texture unit active. Read more

fn split_tex_unit_5(self) -> (Self::Unit, Self::Rest)

Split the 5th texture unit from the context, returning the unit and the remaining context. Read more

fn active_texture_5(self) -> (TextureUnitBinding, Self::Rest) where Self: Sized

Make the 5th texture unit active, returning a binding and the remaining context Read more

impl<B, F, P, R, T0, T1, T2, T3, T4, T5, T6, T7> TextureUnit6Context for ContextOf<B, F, P, R, TextureUnitsOf<T0, T1, T2, T3, T4, T5, T6, T7>> where T6: BorrowMut<TextureUnit6>
[src]

type Unit = T6

The type of unit this context contains.

type Rest = ContextOf<B, F, P, R, TextureUnitsOf<T0, T1, T2, T3, T4, T5, (), T7>>

The OpenGL context that will be returned after making the texture unit active. Read more

fn split_tex_unit_6(self) -> (Self::Unit, Self::Rest)

Split the 6th texture unit from the context, returning the unit and the remaining context. Read more

fn active_texture_6(self) -> (TextureUnitBinding, Self::Rest) where Self: Sized

Make the 6th texture unit active, returning a binding and the remaining context Read more

impl<'a, B, F, P, R, T0, T1, T2, T3, T4, T5, T6, T7> TextureUnit6Context for &'a mut ContextOf<B, F, P, R, TextureUnitsOf<T0, T1, T2, T3, T4, T5, T6, T7>> where T6: BorrowMut<TextureUnit6>
[src]

type Unit = &'a mut TextureUnit6

The type of unit this context contains.

type Rest = ContextOf<&'a mut B, &'a mut F, &'a mut P, &'a mut R, TextureUnitsOf<&'a mut T0, &'a mut T1, &'a mut T2, &'a mut T3, &'a mut T4, &'a mut T5, (), &'a mut T7>>

The OpenGL context that will be returned after making the texture unit active. Read more

fn split_tex_unit_6(self) -> (Self::Unit, Self::Rest)

Split the 6th texture unit from the context, returning the unit and the remaining context. Read more

fn active_texture_6(self) -> (TextureUnitBinding, Self::Rest) where Self: Sized

Make the 6th texture unit active, returning a binding and the remaining context Read more

impl<'a, B, F, P, R, T0, T1, T2, T3, T4, T5, T6, T7> TextureUnit6Context for &'a mut ContextOf<B, F, P, R, &'a mut TextureUnitsOf<T0, T1, T2, T3, T4, T5, T6, T7>> where T6: BorrowMut<TextureUnit6>, B: ToMut<'a>, F: ToMut<'a>, P: ToMut<'a>, R: ToMut<'a>
[src]

type Unit = &'a mut TextureUnit6

The type of unit this context contains.

type Rest = ContextOf<B::Mut, F::Mut, P::Mut, R::Mut, TextureUnitsOf<&'a mut T0, &'a mut T1, &'a mut T2, &'a mut T3, &'a mut T4, &'a mut T5, (), &'a mut T7>>

The OpenGL context that will be returned after making the texture unit active. Read more

fn split_tex_unit_6(self) -> (Self::Unit, Self::Rest)

Split the 6th texture unit from the context, returning the unit and the remaining context. Read more

fn active_texture_6(self) -> (TextureUnitBinding, Self::Rest) where Self: Sized

Make the 6th texture unit active, returning a binding and the remaining context Read more

impl<B, F, P, R, T0, T1, T2, T3, T4, T5, T6, T7> TextureUnit7Context for ContextOf<B, F, P, R, TextureUnitsOf<T0, T1, T2, T3, T4, T5, T6, T7>> where T7: BorrowMut<TextureUnit7>
[src]

type Unit = T7

The type of unit this context contains.

type Rest = ContextOf<B, F, P, R, TextureUnitsOf<T0, T1, T2, T3, T4, T5, T6, ()>>

The OpenGL context that will be returned after making the texture unit active. Read more

fn split_tex_unit_7(self) -> (Self::Unit, Self::Rest)

Split the 7th texture unit from the context, returning the unit and the remaining context. Read more

fn active_texture_7(self) -> (TextureUnitBinding, Self::Rest) where Self: Sized

Make the 7th texture unit active, returning a binding and the remaining context Read more

impl<'a, B, F, P, R, T0, T1, T2, T3, T4, T5, T6, T7> TextureUnit7Context for &'a mut ContextOf<B, F, P, R, TextureUnitsOf<T0, T1, T2, T3, T4, T5, T6, T7>> where T7: BorrowMut<TextureUnit7>
[src]

type Unit = &'a mut TextureUnit7

The type of unit this context contains.

type Rest = ContextOf<&'a mut B, &'a mut F, &'a mut P, &'a mut R, TextureUnitsOf<&'a mut T0, &'a mut T1, &'a mut T2, &'a mut T3, &'a mut T4, &'a mut T5, &'a mut T6, ()>>

The OpenGL context that will be returned after making the texture unit active. Read more

fn split_tex_unit_7(self) -> (Self::Unit, Self::Rest)

Split the 7th texture unit from the context, returning the unit and the remaining context. Read more

fn active_texture_7(self) -> (TextureUnitBinding, Self::Rest) where Self: Sized

Make the 7th texture unit active, returning a binding and the remaining context Read more

impl<'a, B, F, P, R, T0, T1, T2, T3, T4, T5, T6, T7> TextureUnit7Context for &'a mut ContextOf<B, F, P, R, &'a mut TextureUnitsOf<T0, T1, T2, T3, T4, T5, T6, T7>> where T7: BorrowMut<TextureUnit7>, B: ToMut<'a>, F: ToMut<'a>, P: ToMut<'a>, R: ToMut<'a>
[src]

type Unit = &'a mut TextureUnit7

The type of unit this context contains.

type Rest = ContextOf<B::Mut, F::Mut, P::Mut, R::Mut, TextureUnitsOf<&'a mut T0, &'a mut T1, &'a mut T2, &'a mut T3, &'a mut T4, &'a mut T5, &'a mut T6, ()>>

The OpenGL context that will be returned after making the texture unit active. Read more

fn split_tex_unit_7(self) -> (Self::Unit, Self::Rest)

Split the 7th texture unit from the context, returning the unit and the remaining context. Read more

fn active_texture_7(self) -> (TextureUnitBinding, Self::Rest) where Self: Sized

Make the 7th texture unit active, returning a binding and the remaining context Read more

impl<B, F, P, R, T> BaseContext for ContextOf<B, F, P, R, T>
[src]

impl<'a, B, F, P, R, T> BaseContext for &'a mut ContextOf<B, F, P, R, T>
[src]

impl<B, F, P, R, T> AContext for ContextOf<B, F, P, R, T>
[src]

impl<'a, B, F, P, R, T> AContext for &'a mut ContextOf<B, F, P, R, T>
[src]