vrmodel

view src/vport.cc @ 3:a1784a4290c2

client-side networking
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 01 Sep 2014 05:59:31 +0300
parents
children
line source
1 #include "vport.h"
2 #include "opengl.h"
4 static void draw_grid(int num_lines, float sep);
6 bool init_vport()
7 {
8 return true;
9 }
11 void destroy_vport()
12 {
13 }
15 void draw_vport()
16 {
17 draw_grid(10, 2.5);
18 }
20 static void draw_grid(int num_lines, float sep)
21 {
22 float size = num_lines * sep;
24 glLineWidth(1);
26 glBegin(GL_LINES);
27 glColor3f(0.3, 0.3, 0.3);
28 for(int i=1; i<=num_lines; i++) {
29 glVertex3f(-i * sep, 0, -size);
30 glVertex3f(-i * sep, 0, size);
31 glVertex3f(i * sep, 0, -size);
32 glVertex3f(i * sep, 0, size);
33 glVertex3f(-size, 0, -i * sep);
34 glVertex3f(size, 0, -i * sep);
35 glVertex3f(-size, 0, i * sep);
36 glVertex3f(size, 0, i * sep);
37 }
38 glEnd();
40 glLineWidth(2);
41 glBegin(GL_LINES);
42 glColor3f(1, 0.3, 0.3);
43 glVertex3f(-size, 0, 0);
44 glVertex3f(size, 0, 0);
45 glColor3f(0.3, 1, 0.3);
46 glVertex3f(0, 0, -size);
47 glVertex3f(0, 0, size);
48 glEnd();
49 }