graphene

diff test/src/main.cc @ 1:f85a59195206

foo
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 24 Jul 2015 01:28:00 +0300
parents
children fb032d88839f
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/src/main.cc	Fri Jul 24 01:28:00 2015 +0300
     1.3 @@ -0,0 +1,59 @@
     1.4 +#include <stdio.h>
     1.5 +#include <stdlib.h>
     1.6 +#include "opengl.h"
     1.7 +#include <GL/glut.h>
     1.8 +
     1.9 +void display();
    1.10 +void reshape(int x, int y);
    1.11 +void keydown(unsigned char key, int x, int y);
    1.12 +void mouse(int bn, int st, int x, int y);
    1.13 +void motion(int x, int y);
    1.14 +
    1.15 +int main(int argc, char **argv)
    1.16 +{
    1.17 +	glutInit(&argc, argv);
    1.18 +	glutInitWindowSize(1280, 800);
    1.19 +	glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
    1.20 +	glutCreateWindow("graphene3d test");
    1.21 +
    1.22 +	glutDisplayFunc(display);
    1.23 +	glutReshapeFunc(reshape);
    1.24 +	glutKeyboardFunc(keydown);
    1.25 +	glutMouseFunc(mouse);
    1.26 +	glutMotionFunc(motion);
    1.27 +
    1.28 +	if(!gph::init_opengl()) {
    1.29 +		return 1;
    1.30 +	}
    1.31 +
    1.32 +	glutMainLoop();
    1.33 +	return 0;
    1.34 +}
    1.35 +
    1.36 +void display()
    1.37 +{
    1.38 +	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    1.39 +
    1.40 +	glutSwapBuffers();
    1.41 +}
    1.42 +
    1.43 +void reshape(int x, int y)
    1.44 +{
    1.45 +	glViewport(0, 0, x, y);
    1.46 +}
    1.47 +
    1.48 +void keydown(unsigned char key, int x, int y)
    1.49 +{
    1.50 +	switch(key) {
    1.51 +	case 27:
    1.52 +		exit(0);
    1.53 +	}
    1.54 +}
    1.55 +
    1.56 +void mouse(int bn, int st, int x, int y)
    1.57 +{
    1.58 +}
    1.59 +
    1.60 +void motion(int x, int y)
    1.61 +{
    1.62 +}