vrmodel

diff src/vport.cc @ 1:76e75cbcb758

foo
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 29 Aug 2014 23:07:59 +0300
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/vport.cc	Fri Aug 29 23:07:59 2014 +0300
     1.3 @@ -0,0 +1,49 @@
     1.4 +#include "vport.h"
     1.5 +#include "opengl.h"
     1.6 +
     1.7 +static void draw_grid(int num_lines, float sep);
     1.8 +
     1.9 +bool init_vport()
    1.10 +{
    1.11 +	return true;
    1.12 +}
    1.13 +
    1.14 +void destroy_vport()
    1.15 +{
    1.16 +}
    1.17 +
    1.18 +void draw_vport()
    1.19 +{
    1.20 +	draw_grid(10, 2.5);
    1.21 +}
    1.22 +
    1.23 +static void draw_grid(int num_lines, float sep)
    1.24 +{
    1.25 +	float size = num_lines * sep;
    1.26 +
    1.27 +	glLineWidth(1);
    1.28 +
    1.29 +	glBegin(GL_LINES);
    1.30 +	glColor3f(0.3, 0.3, 0.3);
    1.31 +	for(int i=1; i<=num_lines; i++) {
    1.32 +		glVertex3f(-i * sep, 0, -size);
    1.33 +		glVertex3f(-i * sep, 0, size);
    1.34 +		glVertex3f(i * sep, 0, -size);
    1.35 +		glVertex3f(i * sep, 0, size);
    1.36 +		glVertex3f(-size, 0, -i * sep);
    1.37 +		glVertex3f(size, 0, -i * sep);
    1.38 +		glVertex3f(-size, 0, i * sep);
    1.39 +		glVertex3f(size, 0, i * sep);
    1.40 +	}
    1.41 +	glEnd();
    1.42 +
    1.43 +	glLineWidth(2);
    1.44 +	glBegin(GL_LINES);
    1.45 +	glColor3f(1, 0.3, 0.3);
    1.46 +	glVertex3f(-size, 0, 0);
    1.47 +	glVertex3f(size, 0, 0);
    1.48 +	glColor3f(0.3, 1, 0.3);
    1.49 +	glVertex3f(0, 0, -size);
    1.50 +	glVertex3f(0, 0, size);
    1.51 +	glEnd();
    1.52 +}