X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=vrfileman;a=blobdiff_plain;f=src%2Fapp.cc;h=859e6f2e937dab3424b2268a3b045edc782af957;hp=f99e034b9a9653017b10122bda766b6652e4ab7e;hb=5854b2eec65e297e1b21e8e1716c02516a3bac4a;hpb=84320a4b92c1922cd40bd7ce3d942d19cc704bd2 diff --git a/src/app.cc b/src/app.cc index f99e034..859e6f2 100644 --- a/src/app.cc +++ b/src/app.cc @@ -5,8 +5,7 @@ #include "gmath/gmath.h" #include "mesh.h" #include "meshgen.h" -#include "sdr.h" -#include "texture.h" +#include "backdrop.h" int win_width, win_height; float win_aspect; @@ -14,13 +13,10 @@ long time_msec; static float cam_theta, cam_phi; static Mesh *mesh_torus; -static Texture *tex_grid; static bool bnstate[16]; static int prev_x, prev_y; -static unsigned int sdr_grid; - bool app_init(int argc, char **argv) { if(init_opengl() == -1) { @@ -43,11 +39,7 @@ bool app_init(int argc, char **argv) mesh_torus = new Mesh; gen_torus(mesh_torus, 1.0, 0.25, 32, 32); - if(!(sdr_grid = create_program_load("sdr/grid.v.glsl", "sdr/grid.p.glsl"))) { - return false; - } - if(!(tex_grid = load_texture("data/purple_grid.png"))) { - delete tex_grid; + if(!init_backdrop()) { return false; } @@ -56,6 +48,8 @@ bool app_init(int argc, char **argv) void app_cleanup() { + delete mesh_torus; + cleanup_backdrop(); } void app_draw() @@ -70,27 +64,7 @@ void app_draw() glLoadMatrixf(view_mat[0]); //mesh_torus->draw(); - - Mat4 xform; - xform.scaling(500.0); - glPushMatrix(); - glMultMatrixf(xform[0]); - - bind_program(sdr_grid); - bind_texture(tex_grid); - - glBegin(GL_QUADS); - glNormal3f(0, 1, 0); - glVertex3f(-1, 0, 1); - glVertex3f(1, 0, 1); - glVertex3f(1, 0, -1); - glVertex3f(-1, 0, -1); - glEnd(); - - bind_texture(0); - bind_program(0); - - glPopMatrix(); + draw_backdrop(); app_swap_buffers(); assert(glGetError() == GL_NO_ERROR);