commit c8d002fcf2b5529e1933a9526eee15dee2a2c711
parent 81fc67bf1500901a26e9d80a0194da604676ac2f
Author: William Casarin <bill@casarin.me>
Date: Sat, 27 Jun 2015 11:37:01 -0700
Updates
Diffstat:
5 files changed, 23 insertions(+), 12 deletions(-)
diff --git a/shell.nix b/shell.nix
@@ -1 +1,2 @@
-with import <nixpkgs> {}; callPackage ./default.nix {}
+{ }:
+with import <nixpkgs> {}; callPackage ./default.nix { }
diff --git a/src/game.h b/src/game.h
@@ -7,7 +7,7 @@
/*
* Global data used by our render callback:
*/
-struct test_resources {
+struct resources {
struct vbo vertex_buffer, element_buffer, normal_buffer;
GLuint vertex_shader, fragment_shader, program;
@@ -32,7 +32,7 @@ struct test_resources {
struct game_state {
int counter;
- struct test_resources test_resources;
+ struct resources test_resources;
};
void init_game(struct game_state *game);
diff --git a/src/render.c b/src/render.c
@@ -53,7 +53,7 @@ static const GLushort cube_indices[] = {
};
void
-init_gl(struct test_resources * resources) {
+init_gl(struct resources *resources) {
glEnable(GL_DEPTH_TEST);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
@@ -144,8 +144,8 @@ recalc_normals(GLint norm_uniform, mat4 *mvp, mat4 *normal) {
static float tmp_matrix[MAT4_ELEMS] = { 0 };
-void
-render (struct test_resources * resources, struct geom *geom) {
+static void
+render_cube (struct resources * resources) {
static float id[MAT4_ELEMS] = { 0 };
mat4_id(id);
@@ -154,9 +154,6 @@ render (struct test_resources * resources, struct geom *geom) {
float *camera = resources->camera;
float fade_factor = resources->fade_factor;
- glClearColor( 0.0f, 0.0f, 0.0f, 1.0f ); //clear background screen to black
- glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
-
static float v3[] = { 1, 1, 0 };
v3[1] = fade_factor * 1.4f;
mat4_rotate(mvp, 0.004f, v3, mvp);
@@ -190,3 +187,16 @@ render (struct test_resources * resources, struct geom *geom) {
//glDisableVertexAttribArray(resources->attributes.position);
}
+static void render_geom (struct resources *res, struct geom_t *slab) {
+}
+
+void
+render (struct resources * resources, struct geom_t *geom) {
+ glClearColor( 0.0f, 0.0f, 0.0f, 1.0f ); //clear background screen to black
+ glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
+
+ render_cube(resources);
+}
+
+
+
diff --git a/src/render.h b/src/render.h
@@ -3,8 +3,8 @@
#include "geometry.h"
-void init_gl(struct test_resources * resources);
-void render (struct test_resources * resources, struct geom *geom);
+void init_gl(struct resources *resources);
+void render (struct resources *resources, struct geom *geom);
void wireframe_mode_on();
void wireframe_mode_off();
diff --git a/src/update.c b/src/update.c
@@ -4,7 +4,7 @@
void update (struct game_state * game) {
unsigned int ms = SDL_GetTicks();
- struct test_resources * res;
+ struct resources *res;
res = &game->test_resources;