Skip to content

Instantly share code, notes, and snippets.

View Dooskington's full-sized avatar

Declan Hopkins Dooskington

View GitHub Profile
use crate::{
color::*,
mesh::{self, Mesh, Vertex},
sprite::*,
texture::*,
window::*,
};
use backend;
use gfx_hal::{
adapter::{Adapter, PhysicalDevice},
@Dooskington
Dooskington / shaders
Created October 9, 2018 14:50
Shaders
FRAGMENT:
#version 450
#extension GL_ARB_separate_shader_objects : enable
layout(location = 0) in vec4 fragColor;
layout(location = 1) in vec2 fragUv;
layout(location = 0) out vec4 target;
#[cfg(windows)]
extern crate gfx_backend_dx12 as backend;
#[cfg(target_os = "macos")]
extern crate gfx_backend_metal as backend;
#[cfg(all(unix, not(target_os = "macos")))]
extern crate gfx_backend_vulkan as backend;
extern crate gfx_hal;
extern crate nalgebra_glm as glm;
extern crate winit;
// Create texture
let (texture_image, texture_memory, texture_view, texture_sampler) = {
let img = image::open("res/textures/costanza.png")
.expect("Failed to load image!")
.to_rgba();
let (width, height) = img.dimensions();
let (texture_image, texture_memory, texture_view) = create_image(