glviewvol

diff src/dicomview.cc @ 1:cc9e0d8590e2

foo
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 27 Dec 2014 06:32:28 +0200
parents 7bdf40403b9c
children 32c4a7160350
line diff
     1.1 --- a/src/dicomview.cc	Sat Dec 27 02:35:58 2014 +0200
     1.2 +++ b/src/dicomview.cc	Sat Dec 27 06:32:28 2014 +0200
     1.3 @@ -1,21 +1,36 @@
     1.4  #include "opengl.h"
     1.5  #include "dicomview.h"
     1.6 +#include "rend_fast.h"
     1.7  
     1.8 +static int win_width, win_height;
     1.9  static float cam_theta, cam_phi, cam_dist = 6;
    1.10  
    1.11 +static Renderer *rend;
    1.12 +
    1.13  extern "C" {
    1.14  
    1.15  int init()
    1.16  {
    1.17 +	rend = new RendererFast;
    1.18 +	if(!rend->init()) {
    1.19 +		return -1;
    1.20 +	}
    1.21 +
    1.22 +	return 0;
    1.23  }
    1.24  
    1.25  void cleanup()
    1.26  {
    1.27 +	rend->destroy();
    1.28 +	delete rend;
    1.29  }
    1.30  
    1.31  void ev_display()
    1.32  {
    1.33  	glClear(GL_COLOR_BUFFER_BIT);
    1.34 +
    1.35 +	rend->update(0);
    1.36 +	rend->render();
    1.37  }
    1.38  
    1.39  void ev_reshape(int x, int y)
    1.40 @@ -23,11 +38,25 @@
    1.41  	win_width = x;
    1.42  	win_height = y;
    1.43  
    1.44 -	glViweport(0, 0, x, y);
    1.45 +	glViewport(0, 0, x, y);
    1.46  }
    1.47  
    1.48 -void ev_keyboard(int key, int press, int x, int y);
    1.49 -void ev_mouse_button(int bn, int press, int x, int y);
    1.50 -void ev_mouse_motion(int x, int y);
    1.51 +void ev_keyboard(int key, int press, int x, int y)
    1.52 +{
    1.53 +	if(press) {
    1.54 +		switch(key) {
    1.55 +		case 27:
    1.56 +			quit();
    1.57 +		}
    1.58 +	}
    1.59 +}
    1.60 +
    1.61 +void ev_mouse_button(int bn, int press, int x, int y)
    1.62 +{
    1.63 +}
    1.64 +
    1.65 +void ev_mouse_motion(int x, int y)
    1.66 +{
    1.67 +}
    1.68  
    1.69  }	// extern "C"