21 void reshape(int x, int y);
22 void keyb(unsigned char key, int x, int y);
23 void keyb_up(unsigned char key, int x, int y);
25 int win_width, win_height;
29 unsigned int fb[FB_W * FB_H];
37 int main(int argc, char **argv)
39 glutInit(&argc, argv);
40 glutInitWindowSize(1280, 960);
41 glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
42 glutCreateWindow("voxel landscape test");
44 glutDisplayFunc(display);
45 glutReshapeFunc(reshape);
46 glutKeyboardFunc(keyb);
47 glutKeyboardUpFunc(keyb_up);
65 if(!(vox = vox_open("data/height.png", "data/color.png"))) {
68 vox_framebuf(vox, FB_W, FB_H, fb);
69 vox_proj(vox, 45, 1, 200);
70 vox_view(vox, pos[0], pos[1], 0);
72 glfb_setup(FB_W, FB_H, GLFB_RGBA32, FB_W * 4);
81 #define WALK_SPEED 0x40000
84 if(input & INP_FWD) pos[1] += WALK_SPEED;
85 if(input & INP_BACK) pos[1] -= WALK_SPEED;
86 if(input & INP_LEFT) pos[0] -= WALK_SPEED;
87 if(input & INP_RIGHT) pos[0] += WALK_SPEED;
89 vox_view(vox, pos[0], pos[1], 0);
96 memset(fb, 0, sizeof fb);
99 vox_sky_grad(vox, 0xcc77ff, 0x5588cc);
105 assert(glGetError() == GL_NO_ERROR);
113 void reshape(int x, int y)
115 glViewport(0, 0, x, y);
121 void keyb(unsigned char key, int x, int y)
145 void keyb_up(unsigned char key, int x, int y)