Skip to content

Instantly share code, notes, and snippets.

@icefoxen
Created February 2, 2017 18:07
Show Gist options
  • Save icefoxen/40b2f33118b9a203ae7c3c8caa61ac42 to your computer and use it in GitHub Desktop.
Save icefoxen/40b2f33118b9a203ae7c3c8caa61ac42 to your computer and use it in GitHub Desktop.
// This does not work when I uncomment color_view and depth_view
pub struct GraphicsContext {
background: pixels::Color,
foreground: pixels::Color,
window: sdl2::video::Window,
gl_context: sdl2::video::GLContext,
device: gfx_device_gl::Device,
factory: gfx_device_gl::Factory,
//color_view: gfx::handle::RenderTargetView<gfx_device_gl::Resources, gfx::format::Srgba8>,
//depth_view: gfx::handle::DepthStencilView<gfx_device_gl::Resources, gfx::format::DepthStencil>,
}
// But this and the typedef below it work just fine.
pub struct GraphicsContext2<R> where R: gfx::Resources {
background: pixels::Color,
foreground: pixels::Color,
window: sdl2::video::Window,
gl_context: sdl2::video::GLContext,
device: gfx_device_gl::Device,
factory: gfx_device_gl::Factory,
color_view: gfx::handle::RenderTargetView<R, gfx::format::Srgba8>,
depth_view: gfx::handle::DepthStencilView<R, gfx::format::DepthStencil>,
}
type GC = GraphicsContext2<gfx_device_gl::Resources>;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment