vrmodel

annotate src/vport.cc @ 5:9e260c091f75

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