projects
/
vrfileman
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
using a texture for the grid is better
[vrfileman]
/
src
/
app.cc
diff --git
a/src/app.cc
b/src/app.cc
index
1de3f89
..
f99e034
100644
(file)
--- a/
src/app.cc
+++ b/
src/app.cc
@@
-6,6
+6,7
@@
#include "mesh.h"
#include "meshgen.h"
#include "sdr.h"
#include "mesh.h"
#include "meshgen.h"
#include "sdr.h"
+#include "texture.h"
int win_width, win_height;
float win_aspect;
int win_width, win_height;
float win_aspect;
@@
-13,6
+14,7
@@
long time_msec;
static float cam_theta, cam_phi;
static Mesh *mesh_torus;
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 bool bnstate[16];
static int prev_x, prev_y;
@@
-44,6
+46,10
@@
bool app_init(int argc, char **argv)
if(!(sdr_grid = create_program_load("sdr/grid.v.glsl", "sdr/grid.p.glsl"))) {
return false;
}
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;
+ return false;
+ }
return true;
}
return true;
}
@@
-71,6
+77,8
@@
void app_draw()
glMultMatrixf(xform[0]);
bind_program(sdr_grid);
glMultMatrixf(xform[0]);
bind_program(sdr_grid);
+ bind_texture(tex_grid);
+
glBegin(GL_QUADS);
glNormal3f(0, 1, 0);
glVertex3f(-1, 0, 1);
glBegin(GL_QUADS);
glNormal3f(0, 1, 0);
glVertex3f(-1, 0, 1);
@@
-78,6
+86,8
@@
void app_draw()
glVertex3f(1, 0, -1);
glVertex3f(-1, 0, -1);
glEnd();
glVertex3f(1, 0, -1);
glVertex3f(-1, 0, -1);
glEnd();
+
+ bind_texture(0);
bind_program(0);
glPopMatrix();
bind_program(0);
glPopMatrix();