|
|
@@ -5,7 +5,7 @@ use glc::{ |
|
|
|
misc::{BindGuard, Bindable}, |
|
|
|
shader::{Program, Type, Uniform}, |
|
|
|
texture::Texture, |
|
|
|
vector::{Vector2f, Vector4f}, |
|
|
|
vector::{Vector2f, Vector3f}, |
|
|
|
vertex_array::{DataType, VertexArray}, |
|
|
|
}; |
|
|
|
use space_crush_common::{ |
|
|
@@ -36,7 +36,7 @@ pub struct Asteroids { |
|
|
|
struct VertexData { |
|
|
|
pos: Vector2f, |
|
|
|
size: gl::GLfloat, |
|
|
|
color: Vector4f, |
|
|
|
color: Vector3f, |
|
|
|
texture: gl::GLint, |
|
|
|
} |
|
|
|
|
|
|
@@ -65,13 +65,13 @@ impl Asteroids { |
|
|
|
const OFFSET_POS: gl::GLsizei = 0; |
|
|
|
const OFFSET_SIZ: gl::GLsizei = OFFSET_POS + size_of::<Vector2f>() as gl::GLsizei; |
|
|
|
const OFFSET_CLR: gl::GLsizei = OFFSET_SIZ + size_of::<gl::GLfloat>() as gl::GLsizei; |
|
|
|
const OFFSET_TEX: gl::GLsizei = OFFSET_CLR + size_of::<Vector4f>() as gl::GLsizei; |
|
|
|
const OFFSET_TEX: gl::GLsizei = OFFSET_CLR + size_of::<Vector3f>() as gl::GLsizei; |
|
|
|
|
|
|
|
let vertex_array = VertexArray::builder() |
|
|
|
.bind_buffer(Buffer::new()?) |
|
|
|
.vertex_attrib_pointer(0, 2, DataType::Float, false, STRIDE, OFFSET_POS)? |
|
|
|
.vertex_attrib_pointer(1, 1, DataType::Float, false, STRIDE, OFFSET_SIZ)? |
|
|
|
.vertex_attrib_pointer(2, 4, DataType::Float, false, STRIDE, OFFSET_CLR)? |
|
|
|
.vertex_attrib_pointer(2, 3, DataType::Float, false, STRIDE, OFFSET_CLR)? |
|
|
|
.vertex_attrib_pointer(3, 1, DataType::Int, false, STRIDE, OFFSET_TEX)? |
|
|
|
.build()?; |
|
|
|
|
|
|
|