nuclear@1: #include "vport.h" nuclear@1: #include "opengl.h" nuclear@1: nuclear@1: static void draw_grid(int num_lines, float sep); nuclear@1: nuclear@1: bool init_vport() nuclear@1: { nuclear@1: return true; nuclear@1: } nuclear@1: nuclear@1: void destroy_vport() nuclear@1: { nuclear@1: } nuclear@1: nuclear@1: void draw_vport() nuclear@1: { nuclear@1: draw_grid(10, 2.5); nuclear@1: } nuclear@1: nuclear@1: static void draw_grid(int num_lines, float sep) nuclear@1: { nuclear@1: float size = num_lines * sep; nuclear@1: nuclear@1: glLineWidth(1); nuclear@1: nuclear@1: glBegin(GL_LINES); nuclear@1: glColor3f(0.3, 0.3, 0.3); nuclear@1: for(int i=1; i<=num_lines; i++) { nuclear@1: glVertex3f(-i * sep, 0, -size); nuclear@1: glVertex3f(-i * sep, 0, size); nuclear@1: glVertex3f(i * sep, 0, -size); nuclear@1: glVertex3f(i * sep, 0, size); nuclear@1: glVertex3f(-size, 0, -i * sep); nuclear@1: glVertex3f(size, 0, -i * sep); nuclear@1: glVertex3f(-size, 0, i * sep); nuclear@1: glVertex3f(size, 0, i * sep); nuclear@1: } nuclear@1: glEnd(); nuclear@1: nuclear@1: glLineWidth(2); nuclear@1: glBegin(GL_LINES); nuclear@1: glColor3f(1, 0.3, 0.3); nuclear@1: glVertex3f(-size, 0, 0); nuclear@1: glVertex3f(size, 0, 0); nuclear@1: glColor3f(0.3, 1, 0.3); nuclear@1: glVertex3f(0, 0, -size); nuclear@1: glVertex3f(0, 0, size); nuclear@1: glEnd(); nuclear@1: }