graphene
annotate test/src/main.cc @ 3:d71b4e899e08
minimal matrix and vec4
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 25 Jul 2015 05:52:39 +0300 |
parents | f85a59195206 |
children |
rev | line source |
---|---|
nuclear@1 | 1 #include <stdio.h> |
nuclear@1 | 2 #include <stdlib.h> |
nuclear@2 | 3 #include "graphene3d.h" |
nuclear@1 | 4 #include <GL/glut.h> |
nuclear@1 | 5 |
nuclear@1 | 6 void display(); |
nuclear@1 | 7 void reshape(int x, int y); |
nuclear@1 | 8 void keydown(unsigned char key, int x, int y); |
nuclear@1 | 9 void mouse(int bn, int st, int x, int y); |
nuclear@1 | 10 void motion(int x, int y); |
nuclear@1 | 11 |
nuclear@1 | 12 int main(int argc, char **argv) |
nuclear@1 | 13 { |
nuclear@1 | 14 glutInit(&argc, argv); |
nuclear@1 | 15 glutInitWindowSize(1280, 800); |
nuclear@1 | 16 glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE); |
nuclear@1 | 17 glutCreateWindow("graphene3d test"); |
nuclear@1 | 18 |
nuclear@1 | 19 glutDisplayFunc(display); |
nuclear@1 | 20 glutReshapeFunc(reshape); |
nuclear@1 | 21 glutKeyboardFunc(keydown); |
nuclear@1 | 22 glutMouseFunc(mouse); |
nuclear@1 | 23 glutMotionFunc(motion); |
nuclear@1 | 24 |
nuclear@1 | 25 if(!gph::init_opengl()) { |
nuclear@1 | 26 return 1; |
nuclear@1 | 27 } |
nuclear@1 | 28 |
nuclear@1 | 29 glutMainLoop(); |
nuclear@1 | 30 return 0; |
nuclear@1 | 31 } |
nuclear@1 | 32 |
nuclear@1 | 33 void display() |
nuclear@1 | 34 { |
nuclear@1 | 35 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); |
nuclear@1 | 36 |
nuclear@1 | 37 glutSwapBuffers(); |
nuclear@1 | 38 } |
nuclear@1 | 39 |
nuclear@1 | 40 void reshape(int x, int y) |
nuclear@1 | 41 { |
nuclear@1 | 42 glViewport(0, 0, x, y); |
nuclear@1 | 43 } |
nuclear@1 | 44 |
nuclear@1 | 45 void keydown(unsigned char key, int x, int y) |
nuclear@1 | 46 { |
nuclear@1 | 47 switch(key) { |
nuclear@1 | 48 case 27: |
nuclear@1 | 49 exit(0); |
nuclear@1 | 50 } |
nuclear@1 | 51 } |
nuclear@1 | 52 |
nuclear@1 | 53 void mouse(int bn, int st, int x, int y) |
nuclear@1 | 54 { |
nuclear@1 | 55 } |
nuclear@1 | 56 |
nuclear@1 | 57 void motion(int x, int y) |
nuclear@1 | 58 { |
nuclear@1 | 59 } |